You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
root changelog for fixed-mode --conventional-commits #1015
Our monorepo is typically distributed as a whole, though each package can live separately. We operate lerna in fixed mode and the recent changes in 2.1.0 that fix #922 are great. One thing that would help us though is the ability to combine the changelog messaging into a root changelog in addition to the package changelogs currently generated in that mode.
Reacted by Sam Gwilym, Aljeksej Jaroševič, azu, Russell Centanni, Mario Nebl, Björn Brauer, Scotty Vernon and Michael
2.b. Add a default conventional-changelog context file to lerna with content similar to: module.exports = { version: repository.version };
The actual changes in lerna are quite simple:
in src/commands/PublishCommand.js move the ConventionalCommitUtilities.updateFixedChangelog() invocation out of the the forEach loop.
In src/ConventionalCommitUtilities.js change the arguments for the changelog cli in updateFixedChangelog to remove --pkg, --commit-path and add --context.
I think 2-2.b. (overwrite version through custom context inside lerna) would be the best way to go, because option 1 would change the behaviour of lerna quite a lot and option 2.a. would duplicate some code from the conventional-changelog-cli - but would in my opinion also be a viable alternative.
I could create a PR for any of these changes, but would like some feedback on the proposed solution / other options first.
I'm no expert, but it would seem sensible to remain with the cli conventional changelog tool since it's actively maintained. That would lead to 2-2-b being the only sensible option, and as far as I understand - a good one for my use case.
Another question: When in fixed mode - do we want to have just one single changelog.md in the root or do we want to have a changelog.md for each package and a root changelog.md?
Seems like it could be configurable. For my use case i’d only want the root changelog. And duplicating the same changes in each package would just create more noise, but I can imagine other use cases where packages are bundled and also published individually where both would be required.
@rsouthgate I created this PR: #1078 and I decided to keep the behaviour the same as before and generate one changelog per package and one consolidated changelog in the root.
I didn't want to complicate the surface of lerna by introducing more options to configure and in your case you could simply put the package changelogs in your .gitignore file.
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Activity
ZauberNerd commentedon Oct 14, 2017
I dug into this and there are a couple of complications:
versionthat is being / has been published.package.jsonfile in the current working directory (and if not found, searching upwards for apackage.jsonfile - see conventional-changelog-core/merge-config and conventional-changelog-cli/cli).package.jsonwith the--pkgoptions (which is done by lerna).Right now I can see two ways to make this work:
versionfield in the rootpackage.jsonfile if it is configured to run infixed-mode.versionthrough a context that can be passed to the conventional-changelog-cli as--contextIf choosing option 2 there are two ways to make this work:
module.exports = { version: repository.version };The actual changes in lerna are quite simple:
src/commands/PublishCommand.jsmove theConventionalCommitUtilities.updateFixedChangelog()invocation out of the theforEachloop.src/ConventionalCommitUtilities.jschange the arguments for the changelog cli inupdateFixedChangelogto remove--pkg,--commit-pathand add--context.I think 2-2.b. (overwrite
versionthrough custom context inside lerna) would be the best way to go, because option 1 would change the behaviour of lerna quite a lot and option 2.a. would duplicate some code from theconventional-changelog-cli- but would in my opinion also be a viable alternative.I could create a PR for any of these changes, but would like some feedback on the proposed solution / other options first.
What are your thoughts on this @rsouthgate & @evocateur ?
rsouthgate commentedon Oct 15, 2017
I'm no expert, but it would seem sensible to remain with the cli conventional changelog tool since it's actively maintained. That would lead to 2-2-b being the only sensible option, and as far as I understand - a good one for my use case.
ZauberNerd commentedon Oct 16, 2017
Another question: When in fixed mode - do we want to have just one single changelog.md in the root or do we want to have a changelog.md for each package and a root changelog.md?
rsouthgate commentedon Oct 16, 2017
Seems like it could be configurable. For my use case i’d only want the root changelog. And duplicating the same changes in each package would just create more noise, but I can imagine other use cases where packages are bundled and also published individually where both would be required.
feat: Generate single root changelog in fixed mode
ZauberNerd commentedon Oct 16, 2017
@rsouthgate I created this PR: #1078 and I decided to keep the behaviour the same as before and generate one changelog per package and one consolidated changelog in the root.
I didn't want to complicate the surface of lerna by introducing more options to configure and in your case you could simply put the package changelogs in your
.gitignorefile.feat: Generate single root changelog in fixed mode
lock commentedon Dec 28, 2018
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.