Skip to main content

webpack S3 scripts

Project description

Installation

$ [sudo] pip install webpack-s3

Pros

  • webpack S3 scripts:
    • create full-access/read-only user and credentials
    • upload/download webpack/

How it works

webpack/ hard-coded folder

hard-coded environment variables:

  • AWS_S3_WEBPACK_BUCKET
  • AWS_S3_WEBPACK_USER
  • AWS_S3_WEBPACK_ACCESS_KEY_ID
  • AWS_S3_WEBPACK_SECRET_ACCESS_KEY

webpack prod config:

const output = {
  path: path.resolve('./webpack'),
  filename: "[name]-[hash].js",
  publicPath: 'https://'+process.env.AWS_S3_WEBPACK_BUCKET+'.s3.amazonaws.com/'
}

Scripts usage

command usage
webpack-s3-create-bucket usage: webpack-s3-create-bucket bucket
webpack-s3-create-full-access-env usage: webpack-s3-create-full-access-env bucket
webpack-s3-create-read-only-env usage: webpack-s3-create-read-only-env bucket
webpack-s3-download usage: webpack-s3-download
webpack-s3-upload usage: webpack-s3-upload

Examples

Makefile, create env

BUCKET=BUCKET_NAME
all:
    test -s .env.s3.webpack || webpack-s3-create-full-access-env $(BUCKET) > .env.s3.webpack
    test -s .env.prod.webpack || webpack-s3-create-read-only-env $(BUCKET) > .env.prod.webpack

build and upload to S3

set -o allexport
. .env.s3.webpack || exit

webpack --config webpack.config.prod.js || exit
webpack-s3-upload

deploy non js/css files to server, for example webpack-stats.json (webpack-bundle-tracker, django-webpack-loader)

Dockerfile

RUN ... \
    webpack-s3-download

ansible-playbook.yml

...
  tasks:
  - name: task_name
    docker_container:
      ...
      env_file: ".env.prod"

python-readme-generator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webpack-s3-2019.8.9.tar.gz (3.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page