@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/

    Install

    npm i @bbc/webpack-s3-uploader

    DownloadsWeekly Downloads

    207

    Version

    1.0.0

    License

    Apache-2.0

    Unpacked Size

    2.73 MB

    Total Files

    16

    Last publish

    Collaborators

    • sheilab6
    • jezhodgesbbc
    • njh-bbc
    • goodkat
    • iplayerradio-aws
    • monsai
    • craigharvie
    • stephenrobertsbbc
    • skillc01
    • davidc6
    • raghuram619
    • hannahdadd
    • sounds-web-jenkins
    • fcocco
    • rmsdev
    • andrewnowakbbc
    • moududabu2019
    • pratyush1192
    • llouisetaylorbbc
    • seankwakbc
    • daniel_brown_bbc
    • herman_komas
    • tasio
    • patrickcunningham
    • garsir01
    • thomgray
    • decyg
    • jaina07
    • shazia
    • tom-scanlon
    • beethechange
    • gmarinov
    • steve_culverwell
    • bhaskv02
    • roberj78
    • ramkup01