@foo-software/s3-directory-sync-cli

2.1.1 • Public • Published

@foo-software/s3-directory-sync-cli

A CLI to sync a local directory with an AWS S3 bucket. Example usage could involve an automated deployment of a serverless web app. This command essentially uploads a folder to a bucket.

Install

For use within a project:

npm install @foo-software/s3-directory-sync-cli --save-dev

For global use:

npm install @foo-software/s3-directory-sync-cli -g

Usage

Command line:

s3-directory-sync \
  --S3_DIRECTORY_SYNC_ACCESS_KEY_ID abcdef \
  --S3_DIRECTORY_SYNC_BUCKET ghijkl \
  --S3_DIRECTORY_SYNC_LOCAL_DIRECTORY build \
  --S3_DIRECTORY_SYNC_SECRET_ACCESS_KEY mnopqr \
  /

In a project package.json (assuming environment variables like S3_DIRECTORY_SYNC_ACCESS_KEY_ID=abcdef):

{
  "scripts": {
    "deploy": "s3-directory-sync"
  }
}

Parameters

Parameters can either be passed in the command line as arguments or as environment variables.

Name Description Default
S3_DIRECTORY_SYNC_ACCESS_KEY_ID The AWS accessKeyId for an S3 bucket. --
S3_DIRECTORY_SYNC_BUCKET The AWS Bucket for an S3 bucket. --
S3_DIRECTORY_SYNC_DERIVE_CONTENT_TYPE If set to true will derive `Content-Type` metadata from file extension via mime-types false
S3_DIRECTORY_SYNC_SECRET_ACCESS_KEY The AWS secretAccessKey for an S3 bucket. --
S3_DIRECTORY_SYNC_LOCAL_DIRECTORY The local directory to sync (upload), relative to the directory of the command execution. --
S3_DIRECTORY_SYNC_PROGRESS If set to true the CLI will display a progress bar. Might be buggy in CI which justifies this option. false
S3_DIRECTORY_SYNC_REMOTE_DIRECTORY The directory of an S3 bucket to sync from a local directory. An empty string signifies the root. ''
S3_DIRECTORY_SYNC_REMOVE_HTML_EXTENSIONS If true HTML files will be uploaded with the `.html` extension omitted from the `Key`. This can be helpful if hosting an S3 website. false
S3_DIRECTORY_SYNC_REMOVE_HTML_EXTENSIONS_EXCLUDE An escape hatch to the above S3_DIRECTORY_SYNC_REMOVE_HTML_EXTENSIONS option. In the future, perhaps we could make this into a regex, but for now you can populate this value with a comma-separated list of paths relative to the local directory. Example static/html/iframe.html,static/html/iframe2.html (no glob pattern or dot prefix). ''
S3_DIRECTORY_SYNC_ACL The Access Control Policy as documented. public-read
S3_DIRECTORY_SYNC_STRICT Set to true if remote files that don't exist locally should be removed. false

Credits

This package was brought to you by Foo - a website quality monitoring tool. Automatically test and monitor website performance, SEO and accessibility with Lighthouse. Analyze historical records of Lighthouse tests with automated monitoring. Report with confidence about SEO and performance improvements to stay on top of changes when they happen!

Package Sidebar

Install

npm i @foo-software/s3-directory-sync-cli

Weekly Downloads

125

Version

2.1.1

License

MIT

Unpacked Size

16.9 kB

Total Files

9

Last publish

Collaborators

  • adamhenson