FLUID-5789: Provide a script for publishing dev version to NPM

Metadata

Source
FLUID-5789
Type
Task
Priority
Major
Status
Closed
Resolution
Fixed
Assignee
Justin Obara
Reporter
Justin Obara
Created
2015-10-08T10:22:35.554-0400
Updated
2017-02-27T15:49:15.214-0500
Versions
N/A
Fixed Versions
  1. 2.0
Component
  1. Build Scripts
  2. Infrastructure
  3. Release

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.

Comments