FLUID-6309 - Use npm prepublishOnly instead of prepublish

Justin Obara obara.justin at gmail.com
Thu Jul 26 11:30:06 UTC 2018


Hi Gio

Thanks for looking into this. I don’t recall any specific need to have all
of these run on install and before publish. I believe, at least originally,
it was just because that’s how NPM worked at the time. That is, there was
only the prepublish step and it ran at both times. With the the build
artifacts being generated before publishing, anyone installing a release
from NPM should really be getting everything they need, and if not, we
should probably fix up the scripts to provide it. However, installing
directly from GitHub, for instance, wouldn’t. However, I’d recommend that
someone just use our dev releases or run the necessary build steps manually
for those cases.

+1 for renaming.

Thanks
Justin


On July 25, 2018 at 6:08:34 PM, Tirloni, Giovanni (gtirloni at ocadu.ca) wrote:

Hi,

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,
Giovanni
_______________________________________________________
fluid-work mailing list - fluid-work at lists.idrc.ocad.ca
To unsubscribe, change settings or access archives,
see https://lists.idrc.ocad.ca/mailman/listinfo/fluid-work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idrc.ocad.ca/pipermail/fluid-work/attachments/20180726/a17d2b62/attachment.html>


More information about the fluid-work mailing list