Expected Behavior
When running lerna version using the conventionalCommits option/flag, Lerna should produce accurate root and package-level change logs.
Current Behavior
Lerna produces accurate package-level change logs, but the root-level change log contains a very verbose change set spanning several releases.
Possible Solution
When generating root-level changelogs, this code path is taken in update-changelog.js. Notice that in the else branch on L44 for non-root packages, tagPrefix is being assigned to options, but this does not happen on the root-level code path. I believe this is sufficient to explain why package-level change logs are produced correctly, but root-level change logs are not.
I have tested this flow locally by adding the following line just below L34 in update-changelog.js, and it resulted in root-level change logs that were accurate:
options.tagPrefix = tagPrefix;
However, I am not aware of the context around why this wasn't being set in the first place, and as such, this solution may have other undesired effects for other use cases that I'm not aware of.
Steps to Reproduce (for bugs)
- Set the same
tagVersionPrefix option for the version and publish commands in lerna.json or use the same --tag-version-prefix flag when executing lerna version and lerna publish below.
- With 1 or more commits representing changes to at least 1 package, run
lerna version.
lerna.json
{
"version": "1.2.3",
"packages": [
"packages/*"
],
"command": {
"bootstrap": {
"ci": false,
"hoist": true
},
"version": {
"message": "chore(release): %v",
"conventionalCommits": true,
"gitTagVersion": true,
"push": false,
"tagVersionPrefix": "foo/v"
},
"publish": {
"verifyAccess": false,
"gitTagVersion": false,
"push": false,
"tagVersionPrefix": "foo/v"
}
}
}
Context
When using lerna version with a custom tagVersionPrefix and conventionalCommits, it is necessary to manually remove all extraneous information from the root-level change log that Lerna produces.
Your Environment
| Executable |
Version |
lerna --version |
3.16.3 |
npm --version |
6.10.1 |
node --version |
10.16.0 |
| OS |
Version |
| NAME |
VERSION |
| macOS Sierra |
10.14.5 |
Expected Behavior
When running
lerna versionusing theconventionalCommitsoption/flag, Lerna should produce accurate root and package-level change logs.Current Behavior
Lerna produces accurate package-level change logs, but the root-level change log contains a very verbose change set spanning several releases.
Possible Solution
When generating root-level changelogs, this code path is taken in
update-changelog.js. Notice that in theelsebranch on L44 for non-root packages,tagPrefixis being assigned tooptions, but this does not happen on the root-level code path. I believe this is sufficient to explain why package-level change logs are produced correctly, but root-level change logs are not.I have tested this flow locally by adding the following line just below L34 in
update-changelog.js, and it resulted in root-level change logs that were accurate:However, I am not aware of the context around why this wasn't being set in the first place, and as such, this solution may have other undesired effects for other use cases that I'm not aware of.
Steps to Reproduce (for bugs)
tagVersionPrefixoption for theversionandpublishcommands inlerna.jsonor use the same--tag-version-prefixflag when executinglerna versionandlerna publishbelow.lerna version.lerna.json
{ "version": "1.2.3", "packages": [ "packages/*" ], "command": { "bootstrap": { "ci": false, "hoist": true }, "version": { "message": "chore(release): %v", "conventionalCommits": true, "gitTagVersion": true, "push": false, "tagVersionPrefix": "foo/v" }, "publish": { "verifyAccess": false, "gitTagVersion": false, "push": false, "tagVersionPrefix": "foo/v" } } }Context
When using
lerna versionwith a customtagVersionPrefixandconventionalCommits, it is necessary to manually remove all extraneous information from the root-level change log that Lerna produces.Your Environment
lerna --version3.16.3npm --version6.10.1node --version10.16.010.14.5