For background, see npm#10074.
Detect if we were run as a result of
npm publish. This is intended to allow you to
easily have prepublish lifecycle scripts that don't run when you run
$ npm install --save-dev in-publish firstname.lastname@example.org node_modules/in-publish
Then edit your package.json to have:
Now when you run:
$ npm install
thing-I-dont-want-on-dev-install won't be run, but...
$ npm publish
thing-I-dont-want-on-dev-install will be run.
It's worth noting that the
prepublish lifecycle is ALSO called when you build a tarball, so:
$ npm pack
Will call your
prepublish lifecycle, but with the example above,
thing-I-dont-want-on-dev-install won't be run.
If you want this, you can use another helper included here:
The above will run your
pack but not on