0.4.0 • Published 9 years ago

deploy-static v0.4.0

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

deploy-static

NPM License Downloads

This is a command built with Node.js to facilitate deployment of static files.

Installation

$ npm i deploy-static -g

Usage

Before deployment, you should upload your static files somewhere and build a list in static.json.

static.json may be an array of {url, path} items, or an object with a files property containing such an array.

{
  "version": "v1.0",
  "files": [{
    "url": "http://my.storage.com/assets/app.js",
    "path": "assets/app.js"
  }, {
    "url": "assets/app.css",
    "path": "assets/app.css"
  }]
}

Each item has a remote url and local path mapping. urls can be both absolute or relative paths.

Then deploy your static files with the command below.

$ deploy-static fetch static.json -t v1.0 -p http://my.storage.com/

After that you will get directory architecture like this:

▾ ./
  ▸ current/ -> versions/v1.0/     # symlink to current version
  ▸ versions/
    ▸ v0.8/
    ▸ v0.9/
    ▸ v1.0/                        # latest version

The latest version will be linked to ./current while the history versions are kept in ./versions so that you can easily rollback.

Note that if the url is relative, the prefix parameter must be assigned. static.json is also an url, either absolute or relative.

Documents

  • deploy-static fetch
usage: deploy-static fetch [-h] [-d DIST] [-V] [-t TAG] [-f] [-p PREFIX] [-S]
                           static

Positional arguments:
  static                the URL or path of static.json, stdin will be read if
                        none is provided

Optional arguments:
  -h, --help            Show this help message and exit.
  -d DIST, --dist DIST  the directory to hold the static files
  -V, --verbose         Show verbose log.
  -t TAG, --tag TAG     the tag of current version, will be used as the
                        subdirectory name, default as current date
  -f, --force           whether to reuse files in an existed tag
  -p PREFIX, --prefix PREFIX
                        the URL prefix for all items with relative paths
  -S, --save-static     whether to store the static.json file
  • deploy-static link
usage: deploy-static link [-h] [-d DIST] tag

Positional arguments:
  tag         the tag or folder name of the version to be linked

Optional arguments:
  -h, --help  Show this help message and exit.
  -d DIST, --dist DIST  the directory to hold the static files
  -V, --verbose         Show verbose log.
  • deploy-static clean
usage: deploy-static clean [-h] [-d DIST] [-t TAG [TAG ...]] [-n NUMBER]
                           [-k KEEP] [-N]


Optional arguments:
  -h, --help            Show this help message and exit.
  -d DIST, --dist DIST  the directory to hold the static files
  -V, --verbose         Show verbose log.
  -t TAG [TAG ...], --tag TAG [TAG ...]
                        Remove obsolete versions by tags.
  -n NUMBER, --number NUMBER
                        Remove the first NUMBER of obsolete versions. If
                        value not provided, the first one will be removed.
  -k KEEP, --keep KEEP  Remove obsolete versions and keep last KEEP ones. If
                        value not provided, the last 4 will be kept.
  -N, --dry             Show versions to be cleaned and exit.

deploy-static

0.4.0

9 years ago

0.3.0

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago