# gulp-awspublish-cloudfront-invalidate

> Invalidates paths published with gulp-awspublish

Latest version **1.0.0** (published 2021-06-20) · 0 weekly downloads

## Install

```sh
npm install gulp-awspublish-cloudfront-invalidate
pnpm add gulp-awspublish-cloudfront-invalidate
yarn add gulp-awspublish-cloudfront-invalidate
bun add gulp-awspublish-cloudfront-invalidate
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-06-20 |
| First published | 2021-06-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Harry Luu |
| Maintainers | luuduchieuharry |
| Keywords | gulp, cloudfront, invalidate, aws, aws-publish, invalidation |

## Links

- npm: https://www.npmjs.com/package/gulp-awspublish-cloudfront-invalidate
- Repository: https://github.com/luuduchieu/gulp-awspublish-cloudfront-invalidate
- Issues: https://github.com/luuduchieu/gulp-awspublish-cloudfront-invalidate/issues
- npm.io page: https://npm.io/package/gulp-awspublish-cloudfront-invalidate

## Dependencies (4)

- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1.16
- [through2](https://npm.io/package/through2.md) 2.0.x
- [fancy-log](https://npm.io/package/fancy-log.md) 1.3.x
- [plugin-error](https://npm.io/package/plugin-error.md) 1.0.x

## Alternatives

- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads
- [@oridune/validator](https://npm.io/package/@oridune/validator.md) — 16 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-06-20

## README

# gulp-awspublish-cloudfront-invalidate
A gulp plugin that allows you to programmatically invalidate paths in AWS cloudfront.

This version invalidates the array of files that were updated, created, or deleted by
[gulp-awspublish](https://github.com/pgherveou/gulp-awspublish/).

This will work with any similar plugin that uses the same `file.s3` API internally.

Tested with `gulp-awspublish` v3.0.1.

See [gulp-awspublish](https://github.com/pgherveou/gulp-awspublish/) for more
implementation details.

## Installation
```
npm install gulp-awspublish-cloudfront-invalidate
```

## Usage

```js
var gulp = require('gulp')
  , awspublish = require('gulp-awspublish')
  , cloudfront = require('gulp-awspublish-cloudfront-invalidate');

var publisher = awspublish.create({
  region: 'your-region-id',
  params: {
    Bucket: '...'
  }
}, {
  cacheFile: 'your-cache-location'
});

// define custom headers
var headers = {
  'Cache-Control': 'max-age=315360000, no-transform, public'
  // ...
};

var cfSettings = {
  distribution: 'E2A654H2YRPD0W', // Cloudfront distribution ID
  accessKeyId: '...',             // Optional AWS Access Key ID
  secretAccessKey: '...',         // Optional AWS Secret Access Key
  sessionToken: '...',            // Optional AWS Session Token
  wait: true,                     // Whether to wait until invalidation is completed (default: false)
  originPath: '/app',             // Configure OriginPath to be removed of file path to invalidation
  indexRootPath: true,            // Invalidate index.html root paths (`foo/index.html` and `foo/`) (default: false)
  bucketInvalidate: true          // Invalidate the whole bucket to reduce invalidate cost
}

gulp.task('invalidate', function () {

  return gulp.src('*')
    .pipe(publisher.publish(headers))
    .pipe(cloudfront(cfSettings))
    .pipe(publisher.cache())
    .pipe(awspublish.reporter());
});
```

## Contact
Harry Luu <luuduchieuharry@gmail.com>

## Credit

Thanks to:

https://github.com/confyio/gulp-cloudfront-invalidate

https://github.com/lpender/gulp-cloudfront-invalidate-aws-publish

https://github.com/pgherveou/gulp-awspublish

https://github.com/sindresorhus/gulp-debug/

---
_Source: https://npm.io/package/gulp-awspublish-cloudfront-invalidate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
