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
@lerna/conventional-commits unable to use conventional-changelog-conventionalcommits #2138
Comments
Same issue here. Steps to reproduce:
It exits after this line, but the changelog config will never be loaded. (when running with So this legacy behavior of lerna will fail:
check here to see how the conventional-changelog-preset-loader was updated. Maybe the legacy behavior can be removed in favor of the new one. Don't have enough insights to have an opinion on that. |
At the time I wrote lerna's preset loader, there wasn't one in conventional-commits yet. We should probably use |
So we are not able to use |
That's right. Unfortunately Lerna is also not creating the changelog correctly even if you use the Angular convention. @evocateur Could we change the preset loader to use the "conventional" preset in the mean time as a quick win? Changing it to be configurable sounds like some more involved work |
The preset loader should be fixed, not arbitrarily changed to a different default. |
I took a look at how the preset loader works internally, but it is quite a bit more complex than I anticipated. Hence my thought of changing the preset as a quick-win. |
I've verified that diff --git a/core/conventional-commits/__tests__/conventional-commits.test.js b/core/conventional-commits/__tests__/conventional-commits.test.js
index 60c8e091..9020a10d 100644
--- a/core/conventional-commits/__tests__/conventional-commits.test.js
+++ b/core/conventional-commits/__tests__/conventional-commits.test.js
@@ -131,6 +131,21 @@ describe("conventional-commits", () => {
expect(bump).toBe("1.1.0");
});
+ it("supports conventionalcommits preset", async () => {
+ const cwd = await initFixture("fixed");
+ const [pkg1] = await getPackages(cwd);
+
+ // make a change in package-1
+ await pkg1.set("changed", 1).serialize();
+ await gitAdd(cwd, pkg1.manifestLocation);
+ await gitCommit(cwd, "feat!: drop it like it's hot");
+
+ const bump = await recommendVersion(pkg1, "fixed", {
+ changelogPreset: "conventionalcommits",
+ });
+ expect(bump).toBe("2.0.0");
+ });
+
it("supports custom tagPrefix in fixed mode", async () => {
const cwd = await initFixture("fixed");
diff --git a/package-lock.json b/package-lock.json
index 284b70f9..1208913f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2400,6 +2400,17 @@
"q": "^1.5.1"
}
},
+ "conventional-changelog-conventionalcommits": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.2.1.tgz",
+ "integrity": "sha512-vC02KucnkNNap+foDKFm7BVUSDAXktXrUJqGszUuYnt6T0J2azsbYz/w9TDc3VsrW2v6JOtiQWVcgZnporHr4Q==",
+ "dev": true,
+ "requires": {
+ "compare-func": "^1.3.1",
+ "lodash": "^4.2.1",
+ "q": "^1.5.1"
+ }
+ },
"conventional-changelog-core": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-3.2.2.tgz",
diff --git a/package.json b/package.json
index 9b9f9fa5..03580ca8 100644
--- a/package.json
+++ b/package.json
@@ -59,6 +59,7 @@
"@lerna-test/update-lerna-config": "file:helpers/update-lerna-config",
"@zkochan/cmd-shim": "^3.1.0",
"camelcase": "^5.3.1",
+ "conventional-changelog-conventionalcommits": "^4.2.1",
"debug": "^4.1.1",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.2.0", |
upstream fix: conventional-changelog/conventional-changelog#521 |
If I get rid of this:
it makes it work. Why is lerna trying to ruin the config output by conventional-changelog itself? |
It's true.. I'm not getting the expected output from the convetionalcommits preset until I force the I'm getting some changelog output, but it's not presented with the proper sections/headings. |
@jccr It's due to this bug: conventional-changelog/conventional-changelog#618 |
Expected Behavior
Should be able to run
$ lerna version prerelease`
with the config
successfully.
Current Behavior
It terminates without any error message:
It just bumps the version on
package.json
, does nothing else.Possible Solution
Related to this commit: conventional-changelog/conventional-changelog@f2fb240
Specially this file: conventional-changelog/conventional-changelog@f2fb240#diff-b79ed7f48102a253b716fdde8b9fbcb7
It introduces some new logic to load the presets. But
lerna
probably uses it's own custom implementation. 🤔Context
Wanted to use
conventional-changelog-conventionalcommits
ascommand.version.changelogPreset
.lerna --version
The text was updated successfully, but these errors were encountered: