How to tag and publish an initial v1.0.0 with conventional commits?
See original GitHub issueI’m having a hard time figuring out how can I tag and publish an initial v1.0.0 with conventional commits using lerna publish
.
This is my lerna.json
:
{
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true,
"command": {
"publish": {
"registry": "http://localhost:4873",
"verifyAccess": false
},
"version": {
"allowBranch": "master",
"conventionalCommits": true,
"exact": true,
"message": "chore(release): update release notes and package versions",
"noCommitHooks": true
}
}
}
Now let’s say I’m working on my first initial version and I have a single package (not relevant to have more for the purpose of this issue) which has "version": "1.0.0"
in package.json
.
If I make fix: ...
commits, lerna publish
will suggest the next version to be v1.0.1
, if I make feat: ...
commits, lerna publish
will suggest the next version to be v1.1.0
. Even if I set "version": "0.0.0"
in package.json
, fix: ...
will lead to v0.0.1
and feat: ...
will lead to v0.1.0
.
The only I’ve found to have lerna publish
to tag and publish the first version as v1.0.0
is to have the major version in package.json
set to 0
(minor and patch can be anything) and then make a BREAKING CHANGE
commit. That way lerna publish
will suggest the next version to be v1.0.0
.
But it doesn’t feel right to add BREAKING CHANGE
to a commit just for the purpose of tagging a first release as v1.0.0
. There’s not breaking change (it’s the initial version after all) and that will be added to CHANGELOG.md
, which doesn’t make sense.
How can I tag and publish the first initial version of my package as v1.0.0
with a single entry on my CHANGELOG.md
something like feat: initial version
?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top GitHub Comments
yeah i understand aligning the behavior with node for 0.x.x, so no arguments there - it just seems like there is no automated way to initially create a package in a monorepo and publish it as 1.0.0 using conventional-commits … running the conventional graduate makes sense, but I’m still unclear how I would automate that since you are required to specify the specific package you want to graduate (otherwise it automatically does all of the pre-release packages in a similar fashion to force publish) … maybe the graduation process isn’t meant to be automated with conventional commits, which is disappointing because otherwise it works flawlessly
After a bit more digging and testing I’ve realized I can just call
lerna publish 1.0.0
to publish the first initial version, no matter the fixes, feats or breaking changes in commit messages (everything will be properly added to the CHANGELOG.md under1.0.0
).