Reputation: 5416
I have a monorepo workspace with several packages. I bump the version of all packages at the same time and publish them using the following command:
npm publish --workspace packages
This publishes the packages sequentially, and if the publishing of a package fails, it skips publishing the next packages. For instance, suppose I am trying to bump the version from v1.0.0
to v1.0.1
, and the publishing of package3
fails. This failure causes package{n>3}
to not get bumped, and it also does not roll back the version bumps of the previous packages.
package1 1.0.0 -> 1.0.1
package2 1.0.0 -> 1.0.1
package3 1.0.0 -> FAILED
package4 1.0.0 -> SKIPPED
package5 1.0.0 -> SKIPPED
I want all my packages to have the same version at all times. However, the current behavior leads to inconsistencies in package versions.
Is there a way I can rollback the version bumps of earlier packages in case of a failure? If not, is there a way I can configure this to run in a transaction so that publishing happens only if all succeed; otherwise, it fails for all?
Edit 1: It appears that this feature is not available in the npm publish
command. I have created a transactional-publish RFC to propose this functionality.
Upvotes: 3
Views: 865