npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.5k stars 3.19k forks source link

[BUG] npm publish -ws is failing #7907

Open manchuck opened 1 week ago

manchuck commented 1 week ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

When you run npm publish -ws, it will go through and publish all those packages. However, if one of those packages is not updated, the command will fail since NPM rejects publishing the same version.

Expected Behavior

Running npm publish -ws will keep publishing the other packages even if one fails

Steps To Reproduce

Create a workspace with three packages (A, B, C) Bump the versions for A and C Run npm publish -ws B will fail to publish and npm will not try to publish C

Environment

//registry.npmjs.org/:_authToken = (protected) save-exact = true save-prefix = ""

; node bin location = /Users/manchuck/.nvm/versions/node/v22.9.0/bin/node ; node version = v22.9.0 ; npm local prefix = /Users/manchuck/Projects/vonage/node-sdk ; npm version = 10.8.3 ; cwd = /Users/manchuck/Projects/vonage/node-sdk/packages ; HOME = /Users/manchuck ; Run npm config ls -l to show all defaults.

manchuck commented 1 week ago

I am opening this as an issue again because if this is intended, then it is poorly implemented. As a workaround for this, a user now has to run a bash script to publish packages when there is no change in the version number for one package in the monorepo:

for i in $(ls -d *)                                                                                                                          ─╯
(cd $i && npm publish)

I'm not sure how this is a breaking change for a fix. Even if this was some breaking change, the remedy is to just add a new flag that can adjust the behavior without changing how it works. Something like --ignore-publish-fail