FLUID-6309 - Use npm prepublishOnly instead of prepublish

Tirloni, Giovanni gtirloni at ocadu.ca
Wed Jul 25 22:08:00 UTC 2018


  This is a change [0] to conform to changes in npm [1] but I wanted to share it more widely in case anyone can see any downsides and/or is relying on this behavior.

  In summary, `prepublish` used to run before `npm publish` and `npm install`. npm has introduced `prepublishOnly` so it only runs, well, before `npm publish` like the name implies.

  Our `prepublish` step is currently set to run `npm run buildDists && npm run buildStylus` which effectively means we're running these Grunt tasks at `npm install` time:

* buildDists
** clean
** lint
** distributions
** cleanForDist
** verifyDistJS
** verifyDistCSS

* buildStylus
** clean:stylus
** stylus:compile

  Besides shaving 1-3min from the `npm install` step, as it's currently specified, would mean the linter is not running during `npm install` and CI can run it as a separate step. Today, the "build" stage is CI fails hard if there are linting issues.

  Do you see need to run all these steps during `npm install`? If so, would it be okay to rename `prepublish` to `prepublishOnly` and add a `preinstall` script for the steps you think are necessary during `npm install`? If not, the PR already contemplates the simplest case (just renaming).

0 - https://github.com/fluid-project/infusion/pull/916
1 - https://docs.npmjs.com/misc/scripts#deprecation-note

Thank you,

More information about the fluid-work mailing list