2.4.1 • Published 2 years ago

fluid-publish v2.4.1

Weekly downloads
92
License
BSD-3-Clause
Repository
github
Last release
2 years ago

fluid-publish

A command line tool and node module that can be used to simplify the process of publishing a module to NPM. This is particularly useful for creating development releases, e.g. nightly or continuous integration releases.

By default this will create a release with version X.x.x-prerelease.yyyymmddThhmmssZ.shortHash where X.x.x is sourced from the version number in the package.json file, -prerelease is from the devTag option (also applied as a tag to the release), and the yyyymmddThhmmssZ.shortHash build identifier is generated based on the latest commit.

Installation

# global install
npm install fluid-publish -g

# local dev install
npm install fluid-publish --save-dev

Usage

Command Line API

Run these commands from the root directory of the module to be published.

# creates a dev release (global install)
fluid-publish

# creates a dev release (local install)
./node_modules/.bin/fluid-publish

--version

value: true (Boolean)

Returns the current version of the Fluid-Publish module itself. No publishing steps will occur when this flag is enabled.

# returns the version of fluid-publish
fluid-publish --version
# fluid-publish 2.0.0

--standard

value: true (Boolean)

Specifies that a standard release should be generated. This creates a release named after the version in the package.json file. It will not increase the version number. However, it will create a tag and publish this tag to the version control system.

# creates a standard release
fluid-publish --standard

--test

value: true (Boolean)

Specifies that a tarball should be created instead of publishing to NPM. This is useful to use a means of testing that the publish will happen correctly.

# creates a tarball
fluid-publish --test
fluid-publish --test --standard

# publishes to NPM
fluid-publish
fluid-publish --standard

--otp

value: (String)

Specifies the one-time password to use. This is required if the NPM account has two-factor authentication enabled.

# publishes to NPM and authenticating with a one-time password
fluid-publish --otp=12345

options

Optional key/value pairs, in the form key=value, to override the default configuration used across the publish script. The defaults can be found in publish.js's package.json file under the defaultOptions key.

NOTE: If only a key is provided, the value is assumed to be true

(See: Options, process.argv)

# publishes a dev build and applies the tag "nightly" to it
fluid-publish devTag="nightly"

JavaScript API

fluid.publish can also be accessed through standard JavaScript function calls in a node app.

dev

Publishes a development build. This creates a release named after the version, but with the build stamp appended to the end. By default this will create a release with version X.x.x-prerelease.yyyymmddThhmmssZ.shortHash where X.x.x is sourced from the version number in the package.json file, -prerelease is from the devTag option (also applied as a tag to the release), and the build identifier (yyyymmddThhmmssZ.shortHash) is generated based on the latest commit.

var publish = require("fluid-publish");
publish.dev();
arguments
  1. isTest {Boolean} - Indicates if this is a test run, if true a tarball will be generated instead of publishing to NPM.
  2. options {Object} - The defaults can be found in publish.js's package.json file under the defaultOptions key. (See: Options)

standard

Publishes a release build. This creates a release named after the version in the package.json file. By default it will not increase the version number, this must be done separately. However, it will create a tag and publish this tag to the version control system.

var publish = require("fluid-publish");
publish.standard();
arguments
  1. isTest {Boolean} - Indicates if this is a test run, if true a tarball will be generated instead of publishing to NPM.
  2. options {Object} - The defaults can be found in publish.js's package.json file under the defaultOptions key. (See: Options)

Options

Publishing Itself

Publish can publish itself to NPM. This can be done using any of the usage methods described above, or via the NPM pub script defined in package.json. The script makes use of the command line interface provided to interact with publish.js. However, with NPM you'll need to provide a set of "--" to identify arguments to the script.

# publishes a dev release to NPM
npm run pub

# publishes a standard release to NPM
npm run pub -- --standard