Catalog npm
Back to packageRELEASE DETAILS

0.1.1

npm

6xs

Simple Storage Service Static Site Sync

awscloudfrontpublishs3simple storage servicessgstatic sitesync
Published22 Dec 2015
Direct dependencies13
Transitive dependenciesNot calculated

README

Current package documentation

6xs

npm version Build Status Code Coverage npm downloads Dependency Status devDependency Status

6xs means Simple Storage Service Static Site Sync.

It takes your /public directory (or however you call it) and pushes its contents (optionally matching with node-glob) into a selected S3 bucket.

It also can:

  • remove remote files that are not found in your local directory
  • create an invalidation for a chosen CloudFront distribution

Usage

This usage example presents all available configuration options:

var sync = require('6xs');
var path = require('path');

sync({
  // defaults to: process.cwd() + '/public'
  base: path.join(__dirname, 'public'),
  // defaults to: '**'
  patterns: ['*.html', 'font/*'],
  // defaults to noop
  logger: function () {
    return console.log.apply(console, arguments);
  },
  // custom mappings between file extension and content type
  // if not provided, libmagic is used for detection
  // values below are used by default:
  contentTypeMap: {
    html: 'text/html',
    css: 'text/css',
    js: 'application/javascript',
    json: 'application/json'
  },
  aws: {
    // have to be provided:
    access_key_id: 'abcdef...',
    secret_access_key: 'xyz987...',
    // defaults:
    ssl: true,
    retries: 3,
    concurrency: 10
  },
  s3: {
    // have to be provided:
    region: 'eu-west-1',
    bucket: 'your-bucket-name',
    // defaults to false:
    remove_remote_surplus: true
    // defaults:
    max_age: 365,
    s_max_age: 1,
  },
  // if the distribution id is provided,
  // its content will be invalidated after the upload
  cf_distribution_id: 'qwerty...'
}, function (err, uploadedFiles) {
  // callback is optional
  // if upload was successful, err will be null
  // uploadedFiles is an array of paths
});

CLI usage

Usage
  $ 6xs <settings/options>

  This will upload the current working directory to the specified S3 bucket.

Required settings
  -i, --id      AWS Access Key ID
  -s, --secret  AWS Secret Access Key
  -b, --bucket  AWS S3 Bucket name
  -r, --region  AWS region

Options
  -p, --patterns     Glob patterns of the files to upload
                     default: **
                     e.g. *.html
                     e.g. *.html,fonts/*

  -ma, --max-age     Cache-Control max-age header, in days
                     default: 365

  -sa, --s-max-age   Cache-Control s-maxage header, in days
                     default: 1

  --retries          Number of retries
                     Default: 3

  --concurrency      Number of concurrent uploads
                     Default: 10

  --remove-surplus   Remove remote files that are not
                     found in your local directory

  --no-ssl           Don't use SSL

  -cf, --cloudfront  The distribution ID to invalidate

Examples
  $ 6xs -i I2B -s KPAvL4GR -b my-s3-site.gov -r us-west-2 --remove-surplus
  Uploading: ...

Contributing

Pull requests and/or issue reports are warmly welcomed!

Running tests

$ npm run test
$ npm run coverage

Running integration tests locally

Travis build won't run integration tests if your PR originates in a fork.

You'll need to provide 4 environmental variables to run integration tests locally. The user identified by the access key has to have an appropriate allowing policy for the S3 bucket assigned.

$ AWS_ACCESS_KEY_ID=key-id \
AWS_SECRET_ACCESS_KEY=secret \
S3_REGION=your-region \
S3_BUCKET=your-test-bucket \
npm run test-integration

If you understand implications you can copy integration-test.sh.dist and adjust it to your needs.

Contributors

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 13

Native requirements
13 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
async
Environment
{
  "local_name": "async",
  "alias": false,
  "peer_metadata": null
}
1.5.0runtime
aws-sdk
Environment
{
  "local_name": "aws-sdk",
  "alias": false,
  "peer_metadata": null
}
2.2.26runtime
glob
Environment
{
  "local_name": "glob",
  "alias": false,
  "peer_metadata": null
}
6.0.1runtime
lodash
Environment
{
  "local_name": "lodash",
  "alias": false,
  "peer_metadata": null
}
3.10.1runtime
mmmagic
Environment
{
  "local_name": "mmmagic",
  "alias": false,
  "peer_metadata": null
}
0.4.1runtime
codecov.io
Environment
{
  "local_name": "codecov.io",
  "alias": false,
  "peer_metadata": null
}
0.1.6development
faucet
Environment
{
  "local_name": "faucet",
  "alias": false,
  "peer_metadata": null
}
0.0.1development
istanbul
Environment
{
  "local_name": "istanbul",
  "alias": false,
  "peer_metadata": null
}
0.4.1development
jshint
Environment
{
  "local_name": "jshint",
  "alias": false,
  "peer_metadata": null
}
2.8.0development
proxyquire
Environment
{
  "local_name": "proxyquire",
  "alias": false,
  "peer_metadata": null
}
1.7.3development
request
Environment
{
  "local_name": "request",
  "alias": false,
  "peer_metadata": null
}
2.67.0development
sinon
Environment
{
  "local_name": "sinon",
  "alias": false,
  "peer_metadata": null
}
1.17.2development
tape
Environment
{
  "local_name": "tape",
  "alias": false,
  "peer_metadata": null
}
4.2.2development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "37b365df97161ecda2283c08437cdc0990d259af",
  "tarball": "https://registry.npmjs.org/6xs/-/6xs-0.1.1.tgz",
  "integrity": "sha512-TnbkMyKiGDidYC0KTHS9y4KkQW2/azZH3LtHxMQswZlyBamjn68xtEaIjYr1q2spEbH/WpDFT98/f+IpE42g8Q==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIB4QqM3VYwXADRXICelcuL916a0z656v8a5NcOcs6XPEAiEAmmpbLiecVE3kTMqYA4oAXB/JmV0bKccvJBOLDC0exVk="
    }
  ]
}

Repository

PENDING
jelz/6xs

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:00 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:ede56546d5a3b0b5da3543faccdf72e373697765b5955c2e60a6719879102b52

Other collected versions

0.5.015 Jan0.4.011 Jun0.3.025 Mar0.2.028 Feb0.1.327 Jan0.1.222 DecView all collected versions →