@minoris/js-uploader
Utility for deploying JS projects to S3 and npm via shipit
Last updated 2 years ago by evulse .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @minoris/js-uploader 
SYNC missed versions from official npm registry.

JS Uploader

Use to upload files to S3 and NPM.

Requirements

  • Node 4+

Configuration

You will need to have a config.ejson file with the following keys:

{
    "_public_key": "",
    "aws": {
        "accessKeyId": "",
        "secretAccessKey": "",
        "region": "",
        "bucket": ""
    }
}

You must ensure shipit runs the following command before deploy script is run.

ejson decrypt -o config.json config.ejson

Usage

Instantiate an Uploader with config object for your project:

/**
 * @param {S3} config.s3 - aws s3 instance
 * @param {Array} config.files - array of file paths to upload
 * @param {String} config.dir - directory to upload all files from
 * @param {String} config.destination - name of s3 directory to upload to
 * @param {Number|String} config.version - version number
 * @param {Boolean} [true] config.latest - whether to upload /latest file
 */
const awsSDK = require('aws-sdk');
const awsConfig = require('../config.json').aws;
const Uploader = require('js-uploader');
const uploader = new Uploader({

const awsS3 = new awsSDK.S3({
  accessKeyId: awsConfig.accessKeyId,
  secretAccessKey: awsConfig.secretAccessKey,
  region: awsConfig.region,
  params: {
    Bucket: awsConfig.bucket,
    ACL: 'public-read'
  }
});

const uploader = new Uploader({
  s3: awsS3,
  dir: 'dist',
  destination: 'buy-button',
  version: currentVersion,
});

uploader.deployStaticFiles();
uploader.npmPublish();

Add the above to a JS file and add it to your shpit.yml:

deploy:
  override:
    - npm install --no-progress
    - ejson decrypt -o config.json config.ejson
    - npm run build
    - node ./scripts/my-deply-script.js

Current Tags

  • 0.1.0                                ...           latest (2 years ago)

1 Versions

  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 3
Dependencies (3)
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |