Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Last active January 31, 2017 19:09
Show Gist options
  • Save bcomnes/34ef9c0d5d7151c715e2e18c5339beda to your computer and use it in GitHub Desktop.
Save bcomnes/34ef9c0d5d7151c715e2e18c5339beda to your computer and use it in GitHub Desktop.
npm prepublish changes
PREPUBLISH AND PREPARE
DEPRECATION NOTE
Since [email protected], the npm CLI has run the prepublish script for both npm publish
and npm install, because it's a convenient way to prepare a package for use (some
common use cases are described in the section below). It has also turned out to
be, in practice, very confusing https://github.com/npm/npm/issues/10074. As of
[email protected], a new event has been introduced, prepare, that preserves this existing
behavior. A new event, prepublishOnly has been added as a transitional strategy to
allow users to avoid the confusing behavior of existing npm versions and only run
on npm publish (for instance, running the tests one last time to ensure they're in
good shape).
IMPORTANT: As of npm@5, prepublish will only be run for npm publish. This will
make its behavior identical to prepublishOnly, so npm@6 or later may drop support
for the use of prepublishOnly, and then maybe we can all forget this embarrassing
thing ever happened.
See https://github.com/npm/npm/issues/10074 for a much lengthier justification,
with further reading, for this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment