README
NCalls
Methods for deploying an SPA to s3 and uploading individual files.
Usage
var aws = {
key: '',
secret: '',
region: 'ap-southeast-1',
bucket: 'smallmu-sandbox'
}
// Deploying an SPA
var deployFactory = require('@smallmultiples/s3')
var deploy = deployFactory({ aws, aws })
deploy('path/to/app/**/*', 'path/to/destination', {
base: 'path/to/app'
versioning: false
}, function (err) {
if (err) console.error(err)
})
// Uploading an individual file
var upload = require('@smallmultiples/s3/file')
upload({
src: 'path/to/src.ext'
dest: 'path/to/dest.ext'
aws: aws
gzip: true
}, function (err) {
if (err) console.error(err)
})
API
deployFactory(options)
Create the deploy()
function, takes an options
object, which has the following properties:
aws
: Object containing aws credentials:key
: Your aws Access Keysecret
: Your aws Secretregion
: The region your s3 bucket lives inbucket
: The bucket to upload to
concurrent
: How many concurrent uploads to run. Defaults to20
.cache
: An object describing the cache settings as described by gulp-awspublish-routercacheTime
: How long to cache for in milliseconds. Defaults to 1 year.
routes
: A function that given a file path returns an object describing how it should be uploaded. See gulp-awspublish-router for more information. Defaults to:function (path) { return { // Text assets get gzipped '^.+\.(?:json|js|css|topojson|geojson|svg)