Imagine we're working on a TypeScript project with a monorepo structure and using Lerna for versioning and publishing packages. We need to make two separate changes that affect the same package.
Firstly, we have the package foo
. One developer has added a new feature on their branch (dev-foo) and wants to test it. By running:
lerna version --include-merged-tags --conventional-prerelease
Lerna will update the version of package foo
to v1.0.0-alpha
, commit the prerelease, and push it to the remote repository.
Meanwhile, another developer made a second change on their own branch (dev-bar) and also wants to do a prerelease. If they run the same command, Lerna would try to update the version of package bar
to v2.0.0-alpha
, but it will fail because the tag v1.0.0-alpha
already exists - even after a git fetch
.
How can we avoid this situation? A possible solution is to update those versions to v1.0.1-alpha
and v2.0.0-alpha
. But how do we do that?
How can we stop Lerna from updating the package version to one that already exists but hasn't been merged yet? For example, bumping a canary version on the dev-foo branch. Essentially, how do we support independent development and prerelase tagging within the same workspace?