gulp-awspublish
Advanced tools
Comparing version 7.1.0 to 8.0.0
@@ -290,3 +290,2 @@ var { S3 } = require('@aws-sdk/client-s3'), | ||
* - force {Boolean} force upload | ||
* - noAcl: do not set x-amz-acl by default | ||
* - simulate: debugging option to simulate s3 upload | ||
@@ -308,6 +307,2 @@ * - createOnly: skip file updates | ||
// add public-read header by default | ||
if (!headers['x-amz-acl'] && !options.noAcl) | ||
headers['x-amz-acl'] = 'public-read'; | ||
const stream = new Transform({ objectMode: true }); | ||
@@ -314,0 +309,0 @@ stream._transform = function (file, enc, cb) { |
{ | ||
"name": "gulp-awspublish", | ||
"version": "7.1.0", | ||
"version": "8.0.0", | ||
"description": "gulp plugin to publish files to amazon s3", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"scripts": { | ||
"lint": "prettier --write **/*.js && eslint --fix .", | ||
"lint": "prettier --write **/*.{js,md} && eslint --fix .", | ||
"pretest": "npm run lint", | ||
@@ -27,0 +27,0 @@ "test": "mocha" |
@@ -18,5 +18,5 @@ # gulp-awspublish | ||
```javascript | ||
var awspublish = require("gulp-awspublish"); | ||
var awspublish = require('gulp-awspublish'); | ||
gulp.task("publish", function() { | ||
gulp.task('publish', function () { | ||
// create a new publisher using S3 options | ||
@@ -26,9 +26,9 @@ // http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property | ||
{ | ||
region: "your-region-id", | ||
region: 'your-region-id', | ||
params: { | ||
Bucket: "..." | ||
} | ||
Bucket: '...', | ||
}, | ||
}, | ||
{ | ||
cacheFileName: "your-cache-location" | ||
cacheFileName: 'your-cache-location', | ||
} | ||
@@ -39,3 +39,3 @@ ); | ||
var headers = { | ||
"Cache-Control": "max-age=315360000, no-transform, public" | ||
'Cache-Control': 'max-age=315360000, no-transform, public', | ||
// ... | ||
@@ -46,8 +46,7 @@ }; | ||
gulp | ||
.src("./public/*.js") | ||
.src('./public/*.js') | ||
// gzip, Set Content-Encoding headers and add .gz extension | ||
.pipe(awspublish.gzip({ ext: ".gz" })) | ||
.pipe(awspublish.gzip({ ext: '.gz' })) | ||
// publisher will add Content-Length, Content-Type and headers specified above | ||
// If not specified it will set x-amz-acl to public-read by default | ||
.pipe(publisher.publish(headers)) | ||
@@ -104,17 +103,10 @@ | ||
By default, the plugin works only when public access to the bucket is **not blocked**: | ||
By default, if no `x-amz-acl` header is passed, the uploaded object will inherit from the bucket setting. If you have specific requirements for the uploaded object, make sure to pass a value for the `x-amz-acl` header: | ||
- Block all public access: **Off** | ||
- Block public access to buckets and objects granted through new access control lists (ACLs): Off | ||
- Block public access to buckets and objects granted through any access control lists (ACLs): Off | ||
- Block public access to buckets and objects granted through new public bucket policies: Off | ||
- Block public and cross-account access to buckets and objects through any public bucket policies: Off | ||
When dealing with a private bucket, make sure to pass the option `{ noAcl: true }` or a value for the `x-amz-acl` header: | ||
```js | ||
publisher.publish({}, { noAcl: true }); | ||
publisher.publish({ "x-amz-acl": "something" }); | ||
publisher.publish({ 'x-amz-acl': 'something' }); | ||
``` | ||
See [canned ACL on AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#CannedACL). | ||
## Testing | ||
@@ -177,10 +169,10 @@ | ||
var publisher = awspublish.create({ | ||
region: "your-region-id", | ||
region: 'your-region-id', | ||
params: { | ||
Bucket: "..." | ||
Bucket: '...', | ||
}, | ||
credentials: { | ||
accessKeyId: "akid", | ||
secretAccessKey: "secret" | ||
} | ||
accessKeyId: 'akid', | ||
secretAccessKey: 'secret', | ||
}, | ||
}); | ||
@@ -192,10 +184,10 @@ ``` | ||
```javascript | ||
var AWS = require("aws-sdk"); | ||
var AWS = require('aws-sdk'); | ||
var publisher = awspublish.create({ | ||
region: "your-region-id", | ||
region: 'your-region-id', | ||
params: { | ||
Bucket: "..." | ||
Bucket: '...', | ||
}, | ||
credentials: new AWS.SharedIniFileCredentials({ profile: "myprofile" }) | ||
credentials: new AWS.SharedIniFileCredentials({ profile: 'myprofile' }), | ||
}); | ||
@@ -214,3 +206,2 @@ ``` | ||
- putOnly: bypass cache and head request (overrides `force`) | ||
- noAcl: do not set x-amz-acl by default | ||
- simulate: debugging option to simulate s3 upload | ||
@@ -226,3 +217,2 @@ - createOnly: skip file updates | ||
- s3.headers: s3 headers for this file. Defaults headers are: | ||
- x-amz-acl: public-read | ||
- Content-Type | ||
@@ -254,5 +244,5 @@ - Content-Length | ||
gulp | ||
.src("./public/*") | ||
.src('./public/*') | ||
.pipe(publisher.publish()) | ||
.pipe(publisher.sync("bar", [/^foo\/bar/, "baz.txt"])) | ||
.pipe(publisher.sync('bar', [/^foo\/bar/, 'baz.txt'])) | ||
.pipe(awspublish.reporter()); | ||
@@ -266,3 +256,3 @@ ``` | ||
gulp | ||
.src("./public/*") | ||
.src('./public/*') | ||
.pipe(publisher.publish()) | ||
@@ -294,3 +284,3 @@ .pipe(publisher.sync()) | ||
gulp | ||
.src("./public/*") | ||
.src('./public/*') | ||
.pipe(publisher.publish()) | ||
@@ -300,3 +290,3 @@ .pipe(publisher.sync()) | ||
awspublish.reporter({ | ||
states: ["create", "update", "delete"] | ||
states: ['create', 'update', 'delete'], | ||
}) | ||
@@ -316,7 +306,7 @@ ); | ||
gulp | ||
.src("examples/fixtures/*.js") | ||
.src('examples/fixtures/*.js') | ||
.pipe( | ||
rename(function(path) { | ||
path.dirname += "/s3-examples"; | ||
path.basename += "-s3"; | ||
rename(function (path) { | ||
path.dirname += '/s3-examples'; | ||
path.basename += '-s3'; | ||
}) | ||
@@ -337,6 +327,6 @@ ) | ||
```js | ||
var parallelize = require("concurrent-transform"); | ||
var parallelize = require('concurrent-transform'); | ||
gulp | ||
.src("examples/fixtures/*.js") | ||
.src('examples/fixtures/*.js') | ||
.pipe(parallelize(publisher.publish(), 10)) | ||
@@ -353,5 +343,5 @@ .pipe(awspublish.reporter()); | ||
```js | ||
var merge = require("merge-stream"); | ||
var gzip = gulp.src("public/**/*.js").pipe(awspublish.gzip()); | ||
var plain = gulp.src(["public/**/*", "!public/**/*.js"]); | ||
var merge = require('merge-stream'); | ||
var gzip = gulp.src('public/**/*.js').pipe(awspublish.gzip()); | ||
var plain = gulp.src(['public/**/*', '!public/**/*.js']); | ||
@@ -358,0 +348,0 @@ merge(gzip, plain) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26221
444
361