Reputation: 11
Let's assume we've got typescript project with monorepo structure and lerna as a tool for versioning and publishing packages. We have to implement two different changes but both are affecting one package.
At the begginig we have package [email protected]
. One developer had implemented feat on his branch (dev-foo) and want to test it. Using:
lerna version --include-merged-tags --conventional-prerelease
lerna will bump version of package foo
to [email protected]
, commit prerelease and push it to origin.
At the same time another dev did the second change on his own branch (dev-bar) and wants to prerelease his changes. Using command above lerna would attempt to bump version on package [email protected]
also to [email protected]
but the command will fail because tag [email protected]
already exists.
It happens after git fetch
also.
How to prevent such behaviour? Suitable solution would be to bump such versions to [email protected]
and [email protected]
. How to achieve that?
How to prevent lerna from bumping package version to one already existed but not merged? Like canary version bumped on dev-foo branch? In another words - how to support independent development and prerelase tagging of the same workspace?
Upvotes: 1
Views: 1937
Reputation: 21
For this you can use lerna publish --canary --preid beta
to get the tag as mentioned in the lerna doc it self.
--preid Unlike the lerna version option of the same name, this option only applies to --canary version calculation.
lerna publish --canary
# uses the next semantic prerelease version, e.g.
# 1.0.0 => 1.0.1-alpha.0
lerna publish --canary --preid next
# uses the next semantic prerelease version with a specific prerelease identifier, e.g.
# 1.0.0 => 1.0.1-next.0
When run with this flag, lerna publish --canary will increment premajor, preminor, prepatch, or prerelease semver bumps using the specified prerelease identifier.
Upvotes: 1