Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dotcom-tool-kit/upload-assets-to-s3

Package Overview
Dependencies
Maintainers
2
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotcom-tool-kit/upload-assets-to-s3 - npm Package Compare versions

Comparing version 1.0.0-beta.29 to 1.0.0-beta.30

36

lib/tasks/upload-assets-to-s3.js

@@ -22,3 +22,3 @@ "use strict";

bucketByEnv: {
review: 'ft-next-hashed-assets-reivew',
review: 'ft-next-hashed-assets-preview',
prod: ['ft-next-hashed-assets-prod', 'ft-next-hashed-assets-prod-us']

@@ -50,16 +50,17 @@ },

const key = path_1.default.posix.join(options.destination, basename);
const params = {
Bucket: '',
Key: key,
Body: fs.createReadStream(file),
ACL: 'public-read',
ContentType: `${type}; charset=utf-8`,
ContentEncoding: encoding,
CacheControl: options.cacheControl
};
const { review, prod } = options.bucketByEnv;
const bucketByEnv = process.env.NODE_ENV === 'branch' ? review : prod;
let currentBucket = '';
try {
if (typeof bucketByEnv === 'string') {
params.Bucket = bucketByEnv;
const params = {
Bucket: bucketByEnv,
Key: key,
Body: fs.createReadStream(file),
ACL: 'public-read',
ContentType: `${type}; charset=utf-8`,
ContentEncoding: encoding,
CacheControl: options.cacheControl
};
currentBucket = params.Bucket;
const data = await s3.upload(params).promise();

@@ -70,3 +71,12 @@ console.log(`Uploaded ${basename} to ${data.Location}`);

for (const bucket of bucketByEnv) {
params.Bucket = bucket;
const params = {
Bucket: bucket,
Key: key,
Body: fs.createReadStream(file),
ACL: 'public-read',
ContentType: `${type}; charset=utf-8`,
ContentEncoding: encoding,
CacheControl: options.cacheControl
};
currentBucket = params.Bucket;
const data = await s3.upload(params).promise();

@@ -78,3 +88,3 @@ console.log(`Uploaded ${basename} to ${data.Location}`);

catch (error) {
console.error(`Upload of ${basename} to ${params.Bucket} failed`);
console.error(`Upload of ${basename} to ${currentBucket} failed`);
throw error;

@@ -81,0 +91,0 @@ }

{
"name": "@dotcom-tool-kit/upload-assets-to-s3",
"version": "1.0.0-beta.29",
"version": "1.0.0-beta.30",
"description": "",

@@ -13,3 +13,3 @@ "main": "lib",

"dependencies": {
"@dotcom-tool-kit/task": "^1.0.0-beta.29",
"@dotcom-tool-kit/task": "^1.0.0-beta.30",
"aws-sdk": "^2.901.0",

@@ -16,0 +16,0 @@ "glob": "^7.1.6",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc