@dotcom-tool-kit/upload-assets-to-s3
Advanced tools
Comparing version 1.0.0-beta.30 to 1.0.0-beta.31
import { Task } from '@dotcom-tool-kit/task'; | ||
export declare type UploadAssetsToS3Options = { | ||
accessKeyId: string; | ||
secretAccessKey: string; | ||
directory: string; | ||
bucketByEnv: { | ||
review: string[] | string; | ||
prod: string[] | string; | ||
}; | ||
destination: string; | ||
extensions: string; | ||
cacheControl: string; | ||
}; | ||
export default class UploadAssetsToS3 extends Task<UploadAssetsToS3Options> { | ||
import { UploadAssetsToS3Options, UploadAssetsToS3Schema } from '@dotcom-tool-kit/types/lib/schema/upload-assets-to-s3'; | ||
export default class UploadAssetsToS3 extends Task<typeof UploadAssetsToS3Schema> { | ||
static description: string; | ||
@@ -16,0 +5,0 @@ static defaultOptions: UploadAssetsToS3Options; |
@@ -21,6 +21,4 @@ "use strict"; | ||
directory: 'public', | ||
bucketByEnv: { | ||
review: 'ft-next-hashed-assets-preview', | ||
prod: ['ft-next-hashed-assets-prod', 'ft-next-hashed-assets-prod-us'] | ||
}, | ||
reviewBucket: ['ft-next-hashed-assets-preview'], | ||
prodBucket: ['ft-next-hashed-assets-prod', 'ft-next-hashed-assets-prod-us'], | ||
destination: 'hashed-assets/page-kit', | ||
@@ -50,4 +48,12 @@ extensions: 'js,css,map,gz,br,png,jpg,jpeg,gif,webp,svg,ico,json', | ||
const key = path_1.default.posix.join(options.destination, basename); | ||
const { review, prod } = options.bucketByEnv; | ||
const bucketByEnv = process.env.NODE_ENV === 'branch' ? review : prod; | ||
const params = { | ||
Bucket: '', | ||
Key: key, | ||
Body: fs.createReadStream(file), | ||
ACL: 'public-read', | ||
ContentType: `${type}; charset=utf-8`, | ||
ContentEncoding: encoding, | ||
CacheControl: options.cacheControl | ||
}; | ||
const bucketByEnv = process.env.NODE_ENV === 'branch' ? options.reviewBucket : options.prodBucket; | ||
let currentBucket = ''; | ||
@@ -54,0 +60,0 @@ try { |
{ | ||
"name": "@dotcom-tool-kit/upload-assets-to-s3", | ||
"version": "1.0.0-beta.30", | ||
"version": "1.0.0-beta.31", | ||
"description": "", | ||
@@ -13,3 +13,4 @@ "main": "lib", | ||
"dependencies": { | ||
"@dotcom-tool-kit/task": "^1.0.0-beta.30", | ||
"@dotcom-tool-kit/task": "^1.0.0-beta.31", | ||
"@dotcom-tool-kit/types": "^1.0.0-beta.31", | ||
"aws-sdk": "^2.901.0", | ||
@@ -16,0 +17,0 @@ "glob": "^7.1.6", |
Sorry, the diff of this file is not supported yet
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
7154
5
120