@gauntface/cli
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -40,31 +40,6 @@ const util = require('util'); | ||
// Add cache headers for assets that do not have a hash | ||
`aws s3 cp \ | ||
${s3Bucket} ${s3Bucket} \ | ||
--exclude="*" \ | ||
--include="*.html" \ | ||
--include="*.xml" \ | ||
--include="*.json" \ | ||
--include="*.svg" \ | ||
--cache-control 'max-age=86400' \ # Set the cache control headers | ||
--acl public-read \ # Make files publicly accessible | ||
--recursive \ # Copy subdirectories and files | ||
--metadata-directive="REPLACE" # Don't error if the metadata is identical`, | ||
makeCopyCmd(s3Bucket, 86400, ['html', 'xml', 'json', 'svg']), | ||
// Add cache headers for assets that do have a hash | ||
`aws s3 cp \ | ||
${s3Bucket} ${s3Bucket} \ | ||
--exclude="*" \ | ||
--include="*.css" \ | ||
--include="*.js" \ | ||
--include="*.png" \ | ||
--include="*.jpg" \ | ||
--include="*.jpeg" \ | ||
--include="*.gif" \ | ||
--include="*.webp" \ | ||
--include="*.woff" \ | ||
--include="*.woff2" \ | ||
--cache-control 'max-age=31104000' \ # Set the cache control headers | ||
--acl public-read \ # Make files publicly accessible | ||
--recursive \ # Copy subdirectories and files | ||
--metadata-directive="REPLACE" # Don't error if the metadata is identical`, | ||
makeCopyCmd(s3Bucket, 31104000, ['css', 'js', 'png', 'jpg', 'jpeg', 'gif', 'webp', 'woff', 'woff2']), | ||
]; | ||
@@ -77,2 +52,22 @@ | ||
function makeCopyCmd(s3Bucket, maxAge, extensions) { | ||
const parts = [ | ||
`aws s3 cp ${s3Bucket} ${s3Bucket}`, | ||
'--exclude="*"', | ||
] | ||
for (const e of extensions) { | ||
parts.push(`--include="*.${e}"`) | ||
} | ||
// --cache-control Set cache control headers | ||
parts.push(`--cache-control 'max-age=${maxAge}'`); | ||
// --acl public-read Makes files accessible via web browser | ||
parts.push(`--acl public-read`); | ||
// --recursive Copy subdirectories and files | ||
parts.push(`--recursive`); | ||
// --metadata-directive Don't error if the metadata is identical | ||
parts.push(`--metadata-directive="REPLACE"`); | ||
return parts.join(" ") | ||
} | ||
async function runCmd(cmd) { | ||
@@ -79,0 +74,0 @@ console.log(`🤖 Running \`${cmd}\``); |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A CLI tool to help with repetitive tasks.", | ||
@@ -9,0 +9,0 @@ "main": "index.js", |
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
14609
68