Provide a script for publishing dev version to NPM

Description

For publishing Infusion as an NPM module, it would be useful to provide a script for automating the task. Publishing a release to npm should be as easy as running npm publish, however publishing a dev build will take some more work, which is why the script is needed.

The script should be able to do the following:

1) Update the package.json to have the correct version number
2) publish to NPM
3) add the "dev" dist-tag
4) clean up package.json (reset to head).

Unfortunately NPM doesn't respect semver's notion of build releases (+buildID). To work around this we will publish dev builds using the following version format.

major.minor.patch-dev.yyyymmddThhmmssZ.shortCommitHash

e.g. 2.0.0-dev.20151007T134312Z.8c33cd4

The date portion is to ensure that the builds are ordered correctly as the commit hash is random. The date format use the ISO8601 format at yyyymmddThhmmssZ where time is in UTC.

Notes:
To get the shorthand of the commit hash use
git rev-parse --verify --short HEAD

To get the UNIX timestamp
git show -s --format=%ct <mytagname>^{commit}

To convert the timestamp use the javascript Date object but multiply the timestamp by 1000 first. Then you'd need to construct the ISO8601 formatted string from this.

Environment

None

Activity

Show:

Justin Obara October 15, 2015 at 7:30 PM
Edited

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created October 8, 2015 at 2:22 PM
Updated February 27, 2017 at 8:49 PM
Resolved August 8, 2016 at 5:49 PM

Flag notifications