node package manager

jsbundle-s3

jsbundle-s3

Bundle, minify, and upload your JS code to Amazon's Simple Storage Service (S3).

Usage:

[JSBUNDLE_ENV=env] jsbundle-s3 <node_package_dir> [--dry-run] [--no-minify] [--version-salt=<version_salt>]

The options are basically identical to the jsbundle options.

There are a few differences to the jsbundle options:

  1. the --dry-run option, which will run everything except the actual S3 upload.
  2. the --no-minify option, which will turn off minification.
  3. the --version-salt option, which will salt the version hash, for the paranoid.
  4. the "s3" key in jsbundle.json, which is as follows:
<pre>"s3": {
  "accessKeyId": "my_access_key_id",
  "secretAccessKey": "my_secret_access_key",
  "bucketName": "my_bucket",
  "afterUpload": "redis-cli hmset jsbundle.urls $NAME $URL"
}</pre>

afterUpload is optional, and runs a shell command with 3 variables set after S3 upload succeeds:

  • $NAME — the file name (taken from the bundled package's package.json or directory name), e.g.: mypackage.js
  • $VERSION — the sha1 version string, e.g.: 7f2da1cf914bd863068224aa1c10e2ba3a4bd0b0
  • $URL — the url, without a protocol, of the uploaded file, e.g.: //s3.amazonaws.com/my_bucket/7f2da1cf914bd863068224aa1c10e2ba3a4bd0b0/mypackage.js