@bbc/webpack-s3-uploader

1.0.0 • Public • Published

webpack-s3-uploader

Webpack plugin to push assets to s3

Context

There are already a number of webpack plugins out in the wild that can push assets to S3, so you might be wondering why we rolled out our own. In very simple terms, we had issues with all the other ones and the effort involved in just creating our own highly outweighed the effort we were putting into debugging the existing ones.

Usage

In webpack.config.js:

const WebpackS3Uploader = require('@bbc/webpack-s3-uploader');

{
  ...
  plugins: [
    new WebpackS3Uploader({
      whitelist: ['js', 'css'],
      logger: console,
      basePath: 'webpack/assets',
      directory: './web/assets',
      s3Options: {
        region: 'eu-west-1',
        httpOptions: {
          timeout: 240000,
          connectTimeout: 240000
        }
      },
      s3UploadOptions: {
        ACL: 'public-read',
        CacheControl: 'public, max-age=15552000, immutable',
      }
    })
  ]
}

Options

  • whitelist: [Required] An array of extensions to include in the upload. For example - ['js', 'css']
  • directory: [Required] Provide a directory to upload
  • s3Options: Provide options for S3 object s3Config
  • s3UploadOptions: Provide upload options putObject
  • logger: A logger object that supports the standard .info, .log, .error, etc API
  • basePath: Provide the namespace where upload files on S3

Commands

  • yarn test - Run test suite
  • yarn test:coverage - Run test suite with code coverage
  • yarn build - Run build
  • yarn lint - Runs linting over src/ and test/

Dependents (0)

Package Sidebar

Install

npm i @bbc/webpack-s3-uploader

Weekly Downloads

68

Version

1.0.0

License

Apache-2.0

Unpacked Size

2.73 MB

Total Files

16

Last publish

Collaborators

  • mesen
  • alexshelley
  • sadia-taznim
  • iulia.bukhvalova
  • llouisetaylorbbc
  • shaquillaevelyn
  • garwod01
  • priyal2024
  • hangbbc
  • gavyn_bbc
  • river-bbc
  • guptaa01
  • cattranfield
  • ovsichti
  • stevensams
  • sheilab6
  • lokih_
  • tomhobbsbbc
  • jezhodgesbbc
  • njh-bbc
  • iplayerradio-aws
  • monsai
  • stephenrobertsbbc
  • skillc01
  • hannahdadd
  • sounds-web-jenkins
  • rmsdev
  • daniel_brown_bbc
  • tasio
  • decyg
  • shazia
  • beethechange
  • steve_culverwell