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
I have a lerna monorepo using independent mode with several packages. Lerna has solved several problems we had at our company (code splitting, dependency management, logic independence, etc), but it has introduced several challenges that I was unable to solve. The most importants are:
changelog generation
releasing
making commits
The first one depends on the third. We were using github-changelog-generator on each repository, but it does not plays well with lerna.
What I would LOVE to do is generate a changelog for each package and maybe a global changelog with each package as a section.
Now that you have recently added support for conventional-changelog I feel that it should be possible. Several closed issues (like #665 ) makes me think that this should be possible, and people commenting about this is very excited. However, I have no clue about how to do any of the following:
How to setup lerna to use conventional-changelog
How can I invoke conventional-changelog through lerna
How can I generate an automatic CHANGELOG file under each package directory
How can I enable conventional changelog by default on lerna.json
How can I scope/relate one specific commit message to the package it belongs to
How can I enforce conventional-messages with some kind of commit wizard
I think that the fifth task is done automatically by lerna by using git log scoped to certain directory (not sure where I read that)
The reason I'm asking this here is because I know that lerna guys know about lerna stuff and there are plenty of people here that seems to know how to use this new feature.
I'm using cz-lerna-changelog for commit wizard (6) which also detects which package was/were affected by the changes (5). Regarding commit message enforcement, I'm using husky and validate-commit-msg.
And then for generating changelog, I started doing some tests with lerna-semantic-release but didn't complete them because of lack of time... So if you make some progress on that side share your notes!
@gastonelhordoy Ok, I finally figured it out. Now I'm testing it
I would prefer to provide commit messages per package. I noticed that cz-lerna-changelog detects what packages have changed. Is it possible to configure it to promt per package?
That's the kind of behavior that I want to avoid.
Each commit (in my opinion) should be a working snapshot of the repository at certain point in time. If you commit just parts of it you will have inconsistent states when you navigate through commits. I suffered that several times. I will find easier just to use package headers...
Well, that's what one usually does, commit everything that makes sense to go together... but you wanted "commit messages per package"...
Anyways... basically you need to find out how to adapt these tools to your workflow, or maybe adapt your workflow to these tools, whatever makes more sense to you use case.
Basically a semantic-release that orders commits based on which package they belong to (uses data from cz-lerna-changelog) and then determines on that what the next release should be.
However I thought this was something included in lerna itself. You have mentioned (and I really thank you for it) like 4 third party tools. I expected to need a tool for the commit wizard, and maybe for commit message validation, but I expected lerna to build the changelog files, make the automatic version bump based on git logs and that stuff.
Also I still need answer to the following
How to setup lerna to use conventional-changelog (for bump version during publish for example)
This is documented, my fault, just use --conventional-commits however this does not solves the last point
How can I invoke conventional-changelog through lerna.
As far as I understand, this does not makes any sense. Just use the commit wizard or the publish modifiers
How can I generate an automatic CHANGELOG file under each package directory
I still have doubts about this
How can I enable conventional changelog by default on lerna.json
I suspect that I just have to put conventional-commits under the command section of lerna.json, but I'm not sure
@danielo515 Sorry for the delayed response, but here's my understanding:
--conventional-commits is currently only enabled when you use the "independent" versioning mode, not the default "fixed" versioning (the version field of lerna.json).
Only per-package CHANGELOG.md files are currently updated, not the root.
Enabling --conventional-commits from lerna.json should look something like this:
Dear @gastonelhordoy which commit validator are you using with husky? The only ones that I found do not allow line breaks on the commit message (which is a must have for lerna)
For some reason Lerna keeps creating a release in a changelog with the exact same release points of the previous release. Any idea why this is happening? I'm on an independent style Lerna repo.
Reacted by Jacob LeGrone, Paul Blyth, Fabricio C Zuardi, ✨ Kathryn Gonzalez ✨ and Sudhanshu
@paulblyth I have not. Sometimes it happens, sometimes it doesn't ― sometimes it happens for about 5+ releases in a row and then it stops again. It's really frustrating. Does it happen on all of your packages or only some of them? It only happens on some my packages; others seem to release fine.
@enriquecaballero only some packages - seems to be consistently every release for me at the moment but only published a handful of times. I'm wondering if there's a commit message that keeps being picked up for some reason
Again, a focused, minimal reproduction of these problems would go a long way toward figuring out a solution. We don't even know if this is a lerna bug or a conventional-commits bug, at this point.
I think the problem @paulblyth and @enriquecaballero are reporting is different from my original request, which is a request for documentation about how to use lerna with conventional changelog.
One thing I would like to know, if how can I customize the links generation for example. By default it points to github, and I'm currently using bitbucket.
Yes sorry @danielo515 I didn't mean to hijack; @evocateur I'll try and reproduce separately to the project I'm working on and I'll create a separate ticket for this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
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
gastonelhordoy commentedon May 26, 2017
Hey man, hope this help.
I'm using cz-lerna-changelog for commit wizard (6) which also detects which package was/were affected by the changes (5). Regarding commit message enforcement, I'm using husky and validate-commit-msg.
And then for generating changelog, I started doing some tests with lerna-semantic-release but didn't complete them because of lack of time... So if you make some progress on that side share your notes!
danielo515 commentedon May 26, 2017
Thank you @gastonelhordoy
Could you provide me some guides about how to configure cz-lerna-changelog ? I tried installing it and trying to execute, but it does not work.
danielo515 commentedon May 26, 2017
@gastonelhordoy Ok, I finally figured it out. Now I'm testing it
I would prefer to provide commit messages per package. I noticed that cz-lerna-changelog detects what packages have changed. Is it possible to configure it to promt per package?
gastonelhordoy commentedon May 26, 2017
That's done with different commits, staging only things in a certain package...
danielo515 commentedon May 26, 2017
That's the kind of behavior that I want to avoid.
Each commit (in my opinion) should be a working snapshot of the repository at certain point in time. If you commit just parts of it you will have inconsistent states when you navigate through commits. I suffered that several times. I will find easier just to use package headers...
gastonelhordoy commentedon May 26, 2017
Well, that's what one usually does, commit everything that makes sense to go together... but you wanted "commit messages per package"...
Anyways... basically you need to find out how to adapt these tools to your workflow, or maybe adapt your workflow to these tools, whatever makes more sense to you use case.
danielo515 commentedon May 26, 2017
Yes, one way or the other 😄
But then how does lerna decide which messages to include on each package changelog?
gastonelhordoy commentedon May 26, 2017
Read the docs:
https://github.com/atlassian/lerna-semantic-release#lerna-semantic-release
danielo515 commentedon May 31, 2017
Thanks again @gastonelhordoy
However I thought this was something included in lerna itself. You have mentioned (and I really thank you for it) like 4 third party tools. I expected to need a tool for the commit wizard, and maybe for commit message validation, but I expected lerna to build the changelog files, make the automatic version bump based on git logs and that stuff.
Also I still need answer to the following
--conventional-commitshowever this does not solves the last pointThanks again
evocateur commentedon Jun 6, 2017
@danielo515 Sorry for the delayed response, but here's my understanding:
--conventional-commitsis currently only enabled when you use the "independent" versioning mode, not the default "fixed" versioning (theversionfield oflerna.json).CHANGELOG.mdfiles are currently updated, not the root.--conventional-commitsfromlerna.jsonshould look something like this:{ "lerna": "2.0.0-rc.5", "command": { "publish": { "conventionalCommits": true } }, "version": "independent" }danielo515 commentedon Jun 7, 2017
Thanks @evocateur for your response.
I am indeed using the independent versioning mode in all my repositories.
Then how do you build/bundle a global changelog?
Thanks for confirming the correct format on lerna.json, I was thinking it should be like you described, but I was not sure.
Regards
danielo515 commentedon Jun 7, 2017
Dear @gastonelhordoy which commit validator are you using with husky? The only ones that I found do not allow line breaks on the commit message (which is a must have for lerna)
Regards
danielo515 commentedon Jun 14, 2017
@evocateur the way you suggested to include conventional commits on lerna.json is not working. It is ignored by lerna.
evocateur commentedon Jun 14, 2017
If you could reproduce a failing test case, that would be a great start to a pull request to fix it.
enriquecaballero commentedon Jul 11, 2017
For some reason Lerna keeps creating a release in a changelog with the exact same release points of the previous release. Any idea why this is happening? I'm on an independent style Lerna repo.
paulblyth commentedon Sep 11, 2017
I'm currently experiencing the same issue @enriquecaballero - did you resolve it?
enriquecaballero commentedon Sep 11, 2017
@paulblyth I have not. Sometimes it happens, sometimes it doesn't ― sometimes it happens for about 5+ releases in a row and then it stops again. It's really frustrating. Does it happen on all of your packages or only some of them? It only happens on some my packages; others seem to release fine.
paulblyth commentedon Sep 11, 2017
@enriquecaballero only some packages - seems to be consistently every release for me at the moment but only published a handful of times. I'm wondering if there's a commit message that keeps being picked up for some reason
evocateur commentedon Sep 11, 2017
Again, a focused, minimal reproduction of these problems would go a long way toward figuring out a solution. We don't even know if this is a lerna bug or a conventional-commits bug, at this point.
danielo515 commentedon Sep 11, 2017
I think the problem @paulblyth and @enriquecaballero are reporting is different from my original request, which is a request for documentation about how to use lerna with conventional changelog.
One thing I would like to know, if how can I customize the links generation for example. By default it points to github, and I'm currently using bitbucket.
Regards
paulblyth commentedon Sep 11, 2017
Yes sorry @danielo515 I didn't mean to hijack; @evocateur I'll try and reproduce separately to the project I'm working on and I'll create a separate ticket for this
alan-agius4 commentedon Oct 4, 2017
@danielo515 I don't think that is possble at the moment, as lerna uses 'angular' for the convential-changelog and is hard coded and for bitbucket it needs to be 'angular-bitbucket'. https://www.npmjs.com/package/conventional-changelog-angular-bitbucket
To be honest I have the same problem as my repo is in bitbucket
stale commentedon Dec 27, 2018
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
lock commentedon Apr 3, 2019
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.