Description
What
Scripts that use npm publish
should be able to exit with a success code if the version is already published.
Why
I've been using a CI script to build and publish a package to npm. I currently just always try to publish and just accept the error if the current version has already been published.
I'd like to be able to tell Npm: "Don't worry if I've already published this version. I just want to make sure all the other steps leading up to the publish are working as expected."
Note, this is not the same as a --dry-run
. In the cases where I bump my package.json#version
, I want a new version to be published.
Suggestion
A new flag for npm publish
, maybe "--republish-ok
" that makes npm publish
exit without an error code when the package already exists in the target repository.
Related
A alternate, and possibly complimentary, flag would be to ask Npm to compare the two packs. If they don't match, then throw an exit code. Maybe it can be called "--verify-existing
".