-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conventional Commit with Fixed versioning #1383
Comments
Yes, this is what lerna itself does. |
Okay. Then help me identify if below is a bug or an expected behavior. I have two packages currently managed by lerna. I am using default versioning with conventional commit. I am ensuring that commit messages are in conventional commit format. After every commit, I run the below command.
Let's say the initial versions are:
For any commit, that requires minor and patch version update according to conventional commits guidelines, Lerna correctly updates the versions of all packages even those which did not have any change since the last release. This is good. But when i create a Breaking Change commit which only modifies one package, say package-1, the above Lerna publish command only updates the major version of package-1. But, package-2's version is not modified. I would expect the major version of package-2 to be modified as well.
Now I create another patch commit involving only package-1. This time, all the package versions are now modified. Moreover, the major version of package 2 also gets updated.
Is this an expected behavior? If not, am i missing something with config or this is indeed a bug? Here is my lerna.json:
|
This would have been useful information to include in the original bug report. |
Why the |
@evocateur Yes, I agree I should have added the details with the original description. I am in the process of setting up a new Angular 5 mono repo. The two lerna packages are component libraries. We are using https://github.com/dherges/ng-packagr to transpile and build the distribution in Angular Package format. This is an important use case for us. Lerna publish doesn't support publishing a folder/tarball within a package. I have seen few threads on these in Lerna forum and I understand that the Lerna team is against providing this use case. But it is also important for us to publish the transpiled package. So I am trying to work around these requirements.
Lerna has helped us with a lot of our use case. Thanks for actively maintaining it! |
@evocateur I tried digging into the code myself. Here is what I found. Below line is updating pkg's version to the global version in Fixed mode. It is iterating over the pkgs in this.updates. lerna/commands/publish/index.js Line 319 in 9879fef
If we go to line 126, we can see that this.updates contains the list of packages that are updated. lerna/commands/publish/index.js Line 126 in 9879fef
This could be the reason for my issue. It seems like for Fixed mode, we should be iterating over all packages instead of the updated ones. Thoughts? |
I think you're right, logically, but in practice, it's mostly an aberration around how we handle major version bumps. I would definitely expect a conventional major bump in a fixed repo to bump all packages. ...and as far as I can tell, it kinda means we would have to refactor Right now, a workaround exists (for fixed versioning), although it is regrettably not exactly automatic: When you know there is a breaking change, pass |
Thanks Daniel! This works. Although, are you planning to fix this as a bug in the current version or the upcoming version? I can attempt at submitting a PR for this change. |
I created a PR #1391, please have a look @evocateur |
I would wait for this fix to go in. :) |
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. |
Do we support publish with conventional-commits for fixed versioning?
The text was updated successfully, but these errors were encountered: