1.1.6 • Published 5 years ago
satay v1.1.6
satay
A utility for uploading static sites to AWS S3.
Usage
Using the CLI
Install
satay
globally:$ npm install -g satay
Create a configuration file:
satay.config.js
module.exports = { bucket: 'jameslnewell.me', groups: [ { source: './static', include: /\.html$/ }, //cache finger-printed assets for up to 1 year { source: './static', exclude: /\.html$/, params: { CacheControl: `max-age=${60 * 60 * 24 * 365.25}, public` } } ] };
Configure your AWS credentials
Run
satay
$ satay
Using the API
Install
satay
locally:$ npm install --save-dev satay
Create a script file:
upload.js
const satay = require('satay'); satay('jameslnewell.me', [ { source: './static', include: /\.html$/ }, //cache finger-printed assets for up to 1 year { source: './static', exclude: /\.html$/, params: { CacheControl: `max-age=${60 * 60 * 24 * 365.25}, public` } } ]);
Configure your AWS credentials
Run
upload.js
$ node upload.js
CLI
$ satay --config=satay.config.js --force-upload
Flags:
--config
- Optional. The configuration file name. Defaults tosatay.config.js
in the current working directory.
Configuration
Properties:
bucket
- Optional. Astring
. The name of the bucket.groups
- Required. Anarray
of file groupings.source
- Optional. Astring
. The directory that will be searched. Defaults toprocess.cwd()
.include
- Optional. ARegExp
orfunction
. A regular expression or function to filter which files are included.exclude
- Optional. ARegExp
orfunction
. A regular expression or function to filter which files are excluded.prefix
- Optional. Astring
. The prefix that will be prepended to the object key. Defaults to""
.params
- Optional. Anobject
. The additional parameters to pass toS3.putObject()
. Defaults to{ContentType: mime.lookup(filename), ACL: 'public-read'}
.
policy
- Optional. Anobject
. The AWS policy. Defaults to public read access for all files.website
- Optional. Anobject
. The AWS website configuration. Usesindex.html
as the defaultIndexDocument
and404.html
as the defaultErrorDocument
.
API
satay(bucket: String, groups: Array<Group>, options: Object): Promise
Parameters:
bucket
- Optional. Astring
. The name of the bucket.groups
- Required. Anarray
of file groupings.source
- Optional. Astring
. The directory that will be searched. Defaults toprocess.cwd()
.include
- Optional. ARegExp
orfunction
. A regular expression or function to filter which files are included.exclude
- Optional. ARegExp
orfunction
. A regular expression or function to filter which files are excluded.prefix
- Optional. Astring
. The prefix that will be prepended to the object key. Defaults to""
.params
- Optional. Anobject
. The additional parameters to pass toS3.putObject()
. Defaults to{ContentType: mime.lookup(filename), ACL: 'public-read'}
.
options
- Optional. Anobject
. Additional options.policy
- Optional. Anobject
. The AWS policy. Defaults to public read access for all files.website
- Optional. Anobject
. The AWS website configuration. Usesindex.html
as the defaultIndexDocument
and404.html
as the defaultErrorDocument
.
Change log
2.0.0-preview.6
5 years ago
2.0.0-preview.5
5 years ago
2.0.0-preview.4
5 years ago
2.0.0-preview.3
5 years ago
2.0.0-preview.2
5 years ago
2.0.0-preview.1
5 years ago
1.1.6
7 years ago
1.1.5
7 years ago
1.1.4
7 years ago
1.1.3
7 years ago
1.1.2
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago