3.2.0 • Published 9 days ago

@dotcom-tool-kit/upload-assets-to-s3 v3.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 days ago

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

Upload files to a configured AWS S3 bucket.

Installation

Install @dotcom-tool-kit/upload-assets-to-s3 as a devDependency in your app:

npm install --save-dev @dotcom-tool-kit/upload-assets-to-s3

Add the plugin to your Tool Kit configuration:

plugins:
	- '@dotcom-tool-kit/upload-assets-to-s3'

Options

KeyDescriptionDefault value
accessKeyIdEnvVarvariable name of the project's aws access key id. If uploading to multiple buckets the same credentials will need to work for all.no default value - for backwards compatability the plugin falls back to the default value for accessKeyId
secretAccessKeyEnvVarvariable name of the project's aws secret access keyno default value - for backwards compatability the plugin falls back to the default value for secretAccessKey
accessKeyIdDEPRECATED variable name of the project's aws access key id'aws_access_hashed_assets'
secretAccessKeyDEPRECATED variable name of the project's aws secret access key'aws_secret_hashed_assets'
directorythe folder in the project whose contents will be uploaded to S3'public'
reviewBucketthe development or test S3 bucket['ft-next-hashed-assets-preview']
prodBucketproduction S3 bucket/s; an array of strings. The same files will be uploaded to each. Note: most Customer Products buckets that have a prod and prod-us version are already configured in AWS to replicate file changes from one to the other so you don't need to specify both here. Also, if multiple buckets are specified the same credentials will need to be valid for both for the upload to be successful['ft-next-hashed-assets-prod']
regionthe AWS region your buckets are stored in (let the Platforms team know if you need to upload to multiple buckets in multiple regions)eu-west-1
destinationthe destination folder for uploaded assets. Set to '' to upload assets to the top level of the bucket'hashed-assets/page-kit'
extensionsfile extensions to be uploaded to S3'js,css,map,gz,br,png,jpg,jpeg,gif,webp,svg,ico,json'
cacheControlheader that controls how long your files stay in a CloudFront cache before CloudFront forwards another request to your origin'public, max-age=31536000, stale-while-revalidate=60, stale-if-error=3600'

Example:

'@dotcom-tool-kit/upload-assets-to-s3':
  '@dotcom-tool-kit/upload-assets-to-s3':
    accessKeyId: AWS_ACCESS
    secretAccessKey: AWS_KEY
    prodBucket: ['ft-next-service-registry-prod']
    reviewBucket: ['ft-next-service-registry-dev']
    destination: ''

Testing uploads using the review bucket

You can test uploads to S3 locally on your review bucket to check that you are happy with the configuration. To do this set your NODE_ENV to branch:

$ export NODE_ENV=branch

If the AWS key names for accessing the review bucket are different to the prod bucket then update those in the .toolkitrc.yml.

The UploadAssetsToS3 task can run on any hook so you can configure it to run on a local hook to test deployment from the command line. For example, it could be added to your build:local hook as follows:

plugins:
  - '@dotcom-tool-kit/webpack'
  - '@dotcom-tool-kit/upload-assets-to-s3'
hooks:
  'build:local':
    - WebpackDevelopment
    - UploadAssetsToS3

Then running npm run build will run the UploadAssetsToS3 task on your review bucket.

Tasks

NameDescriptionPreconfigured Hook
UploadAssetsTos3Uploads provided files to a given S3 bucketrelease:remote
4.0.0-beta.2

9 days ago

4.0.0-beta.1

9 days ago

4.0.0-beta.0

10 days ago

3.2.0

4 months ago

3.1.7

5 months ago

3.1.3

10 months ago

3.1.6

7 months ago

3.1.5

7 months ago

3.1.4

8 months ago

3.1.2

11 months ago

3.1.1

12 months ago

3.1.0

1 year ago

3.0.0

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.3

1 year ago

2.1.0

1 year ago

2.0.13

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.0.10

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.3

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.9.0

2 years ago

1.8.4-beta.1

2 years ago

1.8.2

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.8.4

2 years ago

1.8.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.7.0-beta.0

2 years ago

1.7.0-beta.3

2 years ago

1.7.0-beta.4

2 years ago

1.7.0-beta.1

2 years ago

1.7.0-beta.2

2 years ago

1.7.0-beta.5

2 years ago

1.6.0-beta.4

2 years ago

1.6.0-beta.3

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.2.3

2 years ago

1.4.0

2 years ago

1.2.2

2 years ago

1.0.2-beta.17

2 years ago

1.0.2-beta.18

2 years ago

1.0.2-beta.15

2 years ago

1.0.2-beta.16

2 years ago

1.0.2-beta.13

2 years ago

1.0.2-beta.14

2 years ago

1.0.2-beta.11

2 years ago

1.0.2-beta.12

2 years ago

1.0.2-beta.10

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.3.0

2 years ago

1.0.2-beta.2

2 years ago

1.6.0-beta.1

2 years ago

1.0.2-beta.3

2 years ago

1.6.0-beta.2

2 years ago

1.0.2-beta.1

2 years ago

1.0.2-beta.7

2 years ago

1.0.2-beta.4

2 years ago

1.0.2-beta.5

2 years ago

1.0.2-beta.8

2 years ago

1.0.2-beta.9

2 years ago

1.2.1

2 years ago

1.2.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.1.0

3 years ago

1.0.0-beta.33

3 years ago

1.0.0-beta.31

3 years ago

1.0.0-beta.32

3 years ago

1.0.0-beta.30

3 years ago

1.0.0-beta.29

3 years ago

1.0.0-beta.28

3 years ago

1.0.0-beta.26

3 years ago

1.0.0-beta.27

3 years ago

1.0.0-beta.25

3 years ago

1.0.0-beta.22

3 years ago

1.0.0-beta.23

3 years ago

1.0.0-beta.21

3 years ago

1.0.0-beta.24

3 years ago

1.0.0-beta.20

3 years ago

1.0.0-beta.11

3 years ago

1.0.0-beta.12

3 years ago

1.0.0-beta.19

3 years ago

1.0.0-beta.17

3 years ago

1.0.0-beta.18

3 years ago

1.0.0-beta.15

3 years ago

1.0.0-beta.16

3 years ago

1.0.0-beta.13

3 years ago

1.0.0-beta.14

3 years ago

1.0.0-beta.10

3 years ago

1.0.0-beta.6

3 years ago

1.0.0-beta.7

3 years ago

1.0.0-beta.8

3 years ago

1.0.0-beta.9

3 years ago

1.0.0-beta.5

3 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta.4

3 years ago

1.0.0-beta.2

3 years ago

1.0.0-beta.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.2.16

3 years ago

0.2.15

3 years ago

0.2.17

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.7

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.6

3 years ago

0.2.3

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago