Skip to content
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

presets flag doesn't work #720

Closed
alebak opened this issue Feb 19, 2021 · 9 comments · Fixed by #723
Closed

presets flag doesn't work #720

alebak opened this issue Feb 19, 2021 · 9 comments · Fixed by #723
Labels

Comments

@alebak
Copy link

alebak commented Feb 19, 2021

Describe the bug
When I use the preset flag, for example 'angular', standard-version always generates the CHANGELOG.md file using always the default conventional-changelog-conventionalcommits.

standard-version --preset angular

or

npm run standard-version --preset angular

Current behavior
The output of CHANGELOG.md is conventional-changelog-conventionalcommits template.

Expected behavior
The output of CHANGELOG.md should be conventional-changelog-angular template.

Environment

  • standard-version version(s): 9.1.1
  • Node/npm version: Node 10/npm 7
  • OS: Ubuntu 20.04 LTS
@jbottigliero
Copy link
Member

@alebak – I've added a very basic test in #723 that covers usage of --preset angular that includes an Angular-supported type (perf:).

What <type>(s) seem to be missing from your generated CHANGELOG?

Apologies if you're already aware, but I feel I must point out in your second example: npm run standard-version --preset angular, if you've set up an npm script as an alias to standard-version you need to use the -- to pass flag arguments.

@alebak
Copy link
Author

alebak commented Feb 27, 2021

Apologies if you're already aware, but I feel I must point out in your second example: npm run standard-version --preset angular, if you've set up an npm script as an alias to standard-version you need to use the -- to pass flag arguments.

Oh! Excuse me... You're right. 😅 I have 'release' alias in my package.json file.

When I run npm run release --preset angular:

> standard-version "angular"

√ bumping version in package.json from 1.1.1-alpha.0 to 1.1.1
√ outputting changes to CHANGELOG.md
√ committing package.json and CHANGELOG.md
√ tagging release v1.1.1
i Run `git push --follow-tags origin master && npm publish` to publish 

But standard-version generates the same Changelog by default. 😥

You can check my test project starwars-name and you will see that I use 'conventional-changelog-cli' to fix the CHANGELOG generated by 'standard-version' and it should not be like that.

Note: npm run release -- --preset angular doesn't work either.

@jbottigliero
Copy link
Member

npm run release --preset angular would be invalid since it is passing the angular argument as a positional argument instead of the value of the --preset flag. But, you mentioned npm run release -- --preset angular doesn't work either, could you provide a little more detail into how running conventional-changelog-cli fixes the CHANGELOG? ie. are there specific types missing when you pass the preset flag to standard-version?

Our test matrix doesn't cover your NPM and Node version combination, so there could be something happening there. If you can provide a snippet that includes the generated CHANGELOG vs. the expected output of the CHANGELOG I can try and diagnose further using the test I've set up in #723.


After removing the postchangelog configuration you have in your package.json, I was able to verify the following in your repository:

% git commit --allow-empty -m "perf: This only shows in the Angular preset."

% npm run release --  --preset=angular --skip.commit --skip.tag             

> starwars-names@1.3.0 release /starwars-name
> standard-version "--preset=angular" "--skip.commit" "--skip.tag"

✔ bumping version in package.json from 1.3.0 to 1.3.1
✔ bumping version in package-lock.json from 1.3.0 to 1.3.1
✔ outputting changes to CHANGELOG.md

% git diff CHANGELOG.md 
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4322eb..9b02d3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,16 @@
+# Changelog
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+## [1.3.1](https://github.com/alebak/starwars-name/compare/v1.3.0...v1.3.1) (2021-02-27)
+
+
+### Performance Improvements
+
+* This only shows in the Angular preset. ([cd852a9](https://github.com/alebak/starwars-name/commit/cd852a9e0853aa73469ef94cb7eb93b1e7832fce))
+
+
+
 # [1.3.0](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.3.0) (2021-02-22)
 
 
@@ -59,6 +72,3 @@
 ### Bug Fixes
 
 * add standard-version ([3d294d7](https://github.com/alebak/starwars-name/commit/3d294d742eeae97947b24627388b2586043cdce9))
-
-
-

Compared to:

% npm run release -- --skip.commit --skip.tag                 

> starwars-names@1.3.0 release /starwars-name
> standard-version "--skip.commit" "--skip.tag"

✔ bumping version in package.json from 1.3.0 to 1.3.1
✔ bumping version in package-lock.json from 1.3.0 to 1.3.1
✔ outputting changes to CHANGELOG.md

% git diff CHANGELOG.md 
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4322eb..f8e6bb3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+# Changelog
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+### [1.3.1](https://github.com/alebak/starwars-name/compare/v1.3.0...v1.3.1) (2021-02-27)
+
 # [1.3.0](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.3.0) (2021-02-22)
 
 
@@ -59,6 +65,3 @@
 ### Bug Fixes
 
 * add standard-version ([3d294d7](https://github.com/alebak/starwars-name/commit/3d294d742eeae97947b24627388b2586043cdce9))
-
-
-

Which looks like expected behavior for processing the preset flag from standard-version's perspective.

@alebak
Copy link
Author

alebak commented Feb 28, 2021

Hi @jbottigliero,

could you provide a little more detail into how running conventional-changelog-cli fixes the CHANGELOG?

I will attach a CHANGELOG with the Angular preset generated with conventional-changelog-cli
CHANGELOG.md.txt

Which looks like expected behavior for processing the preset flag from standard-version's perspective.

If the CHANGELOG has the text "All notable changes to this project will be documented in this file. See standard-version for commit guidelines." then changelog is not using any presets.

You can check it using other presets and the CHANGELOG result will be the same.

@jbottigliero
Copy link
Member

Ah, if the header is the only issue you can override this with anything using the --header flag[1]. This option exists outside the preset and is just something we prepend to the generated changelog.

I could see how that verbiage ("See standard-version for commit guidelines.") could be confusing and might be something worth changing or removing altogether, since standard-version doesn't actually specify the commit guidelines.

[1] npm run release -- --preset angular --header="# Changelog\n\nAll notable changes to this project will be documented in this file. See [angular](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit) for commit guidelines.\n", or omit using npm run release -- --preset angular --header=""

@alebak
Copy link
Author

alebak commented Mar 1, 2021

Please wait for me... I'm going to do a test with this repository, I still think the body doesn't change.

If I'm wrong then I close the issue. 😅

@alebak
Copy link
Author

alebak commented Mar 5, 2021

Hello again,

These were my tests. I confess that the text "All notable changes to this project will be documented in this file. See standard-version for commit guidelines." caused me a lot of noise.

conventionalcommits (default):

npm run release -- --dry-run

> starwars-names@1.3.0 release
> standard-version "--dry-run"

✔ bumping version in package.json from 1.3.0 to 1.4.0
✔ bumping version in package-lock.json from 1.3.0 to 1.4.0
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## [1.4.0](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.4.0) (2021-03-05)


### Features

* **dashboard:** add an initial message from dashboard feature ([cee041d](https://github.com/alebak/starwars-name/commit/cee041dc202199c2128a610ec4cd8bda7ca6ad5d))
* **dashboard:** add new features (feat 1, feat 2 and feat 3) ([e714ecb](https://github.com/alebak/starwars-name/commit/e714ecbc2675e595b3723936866b2c4c5b1f44aa))
* **dashboard:** release dashboard feature ([3ae842e](https://github.com/alebak/starwars-name/commit/3ae842ecc90d4a2f2455882b3937bf1f804ad5a0))


### Bug Fixes

* **dashboard:** fix a message from dashboard ([4ff1baa](https://github.com/alebak/starwars-name/commit/4ff1baa1c1cdc89faa582560b7c4cfebe9151b49))
* fix other thing ([fa29e66](https://github.com/alebak/starwars-name/commit/fa29e66203f3facd4082f1ee686b97a60d5f232d))
* new other message in develop branch ([baeb9d9](https://github.com/alebak/starwars-name/commit/baeb9d9af92f0ce6157a15113e8163e5db4ade55))
* this a fix from develop branch ([6fd3d30](https://github.com/alebak/starwars-name/commit/6fd3d307f92a4487bf21c0a03b7f8222a28ba608))
* **model-users:** fix anything ([2f98a10](https://github.com/alebak/starwars-name/commit/2f98a10d2d2dd85bca82a0689283de2e455aa6cf))
---

✔ Running lifecycle script "postchangelog"
ℹ - execute command: "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v1.4.0
ℹ Run `git push --follow-tags origin develop && npm publish` to publish

angular:

npm run release -- --dry-run --preset angular

> starwars-names@1.3.0 release
> standard-version "--dry-run" "--preset" "angular"

✔ bumping version in package.json from 1.3.0 to 1.4.0
✔ bumping version in package-lock.json from 1.3.0 to 1.4.0
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
# [1.4.0](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.4.0) (2021-03-05)


### Bug Fixes

* **dashboard:** fix a message from dashboard ([4ff1baa](https://github.com/alebak/starwars-name/commit/4ff1baa1c1cdc89faa582560b7c4cfebe9151b49))
* fix other thing ([fa29e66](https://github.com/alebak/starwars-name/commit/fa29e66203f3facd4082f1ee686b97a60d5f232d))
* new other message in develop branch ([baeb9d9](https://github.com/alebak/starwars-name/commit/baeb9d9af92f0ce6157a15113e8163e5db4ade55))
* this a fix from develop branch ([6fd3d30](https://github.com/alebak/starwars-name/commit/6fd3d307f92a4487bf21c0a03b7f8222a28ba608))
* **model-users:** fix anything ([2f98a10](https://github.com/alebak/starwars-name/commit/2f98a10d2d2dd85bca82a0689283de2e455aa6cf))


### Features

* **dashboard:** add an initial message from dashboard feature ([cee041d](https://github.com/alebak/starwars-name/commit/cee041dc202199c2128a610ec4cd8bda7ca6ad5d))
* **dashboard:** add new features (feat 1, feat 2 and feat 3) ([e714ecb](https://github.com/alebak/starwars-name/commit/e714ecbc2675e595b3723936866b2c4c5b1f44aa))
* **dashboard:** release dashboard feature ([3ae842e](https://github.com/alebak/starwars-name/commit/3ae842ecc90d4a2f2455882b3937bf1f804ad5a0))
---

✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v1.4.0
ℹ Run `git push --follow-tags origin develop && npm publish` to publish

atom (same result codemirror and ember):

npm run release -- --dry-run --preset atom

> starwars-names@1.3.0 release
> standard-version "--dry-run" "--preset" "atom"

✔ bumping version in package.json from 1.3.0 to 1.3.1
✔ bumping version in package-lock.json from 1.3.0 to 1.3.1
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## [1.3.1](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.3.1) (2021-03-05)
---

✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v1.3.1
ℹ Run `git push --follow-tags origin develop && npm publish` to publish

eslint:

npm run release -- --dry-run --preset eslint

> starwars-names@1.3.0 release
> standard-version "--dry-run" "--preset" "eslint"

✔ bumping version in package.json from 1.3.0 to 1.3.1
✔ bumping version in package-lock.json from 1.3.0 to 1.3.1
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## [1.3.1](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.3.1) (2021-03-05)


### chore

* add console log message wait dashboard feature ([817e2aa](https://github.com/alebak/starwars-name/commit/817e2aa2a43aeacc6ebccd77d33e390eed902a16))
* adding other message ([6773827](https://github.com/alebak/starwars-name/commit/6773827bb1099909219428d38f3b8af68abb86a9))
* still waiting for the dashboard features ([58dd722](https://github.com/alebak/starwars-name/commit/58dd7227d70564fdff4492232004e73c94c490a5))

### fix

* fix other thing ([fa29e66](https://github.com/alebak/starwars-name/commit/fa29e66203f3facd4082f1ee686b97a60d5f232d))
* new other message in develop branch ([baeb9d9](https://github.com/alebak/starwars-name/commit/baeb9d9af92f0ce6157a15113e8163e5db4ade55))
* this a fix from develop branch ([6fd3d30](https://github.com/alebak/starwars-name/commit/6fd3d307f92a4487bf21c0a03b7f8222a28ba608))
---

✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v1.3.1
ℹ Run `git push --follow-tags origin develop && npm publish` to publish

express:

 npm run release -- --dry-run --preset express

> starwars-names@1.3.0 release
> standard-version "--dry-run" "--preset" "express"

✔ bumping version in package.json from 1.3.0 to 1.3.1
✔ bumping version in package-lock.json from 1.3.0 to 1.3.1
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
[1.3.1](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.3.1) / 2021-03-05
===================
---

✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v1.3.1
ℹ Run `git push --follow-tags origin develop && npm publish` to publish

jquery:

npm run release -- --dry-run --preset jquery

> starwars-names@1.3.0 release
> standard-version "--dry-run" "--preset" "jquery"

✔ bumping version in package.json from 1.3.0 to 1.3.1
✔ bumping version in package-lock.json from 1.3.0 to 1.3.1
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## [1.3.1](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.3.1) (2021-03-05)


### chore

* add console log message wait dashboard feature([817e2aa](https://github.com/alebak/starwars-name/commit/817e2aa2a43aeacc6ebccd77d33e390eed902a16))
* adding other message([6773827](https://github.com/alebak/starwars-name/commit/6773827bb1099909219428d38f3b8af68abb86a9))
* still waiting for the dashboard features([58dd722](https://github.com/alebak/starwars-name/commit/58dd7227d70564fdff4492232004e73c94c490a5))


### fix

* fix other thing([fa29e66](https://github.com/alebak/starwars-name/commit/fa29e66203f3facd4082f1ee686b97a60d5f232d))
* new other message in develop branch([baeb9d9](https://github.com/alebak/starwars-name/commit/baeb9d9af92f0ce6157a15113e8163e5db4ade55))
* this a fix from develop branch([6fd3d30](https://github.com/alebak/starwars-name/commit/6fd3d307f92a4487bf21c0a03b7f8222a28ba608))
---

✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v1.3.1
ℹ Run `git push --follow-tags origin develop && npm publish` to publish

jscs:

npm run release -- --dry-run --preset jscs  ✔  took 12s 

> starwars-names@1.3.0 release
> standard-version "--dry-run" "--preset" "jscs"

Unable to load the "jscs" preset package. Please make sure it's installed.
npm ERR! code 1
npm ERR! path /mnt/d/workspace/alebak/starwars-names
npm ERR! command failed
npm ERR! command sh -c standard-version "--dry-run" "--preset" "jscs"

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/alebak/.npm/_logs/2021-03-05T22_02_43_187Z-debug.log

jshint:

npm run release -- --dry-run --preset jshint

> starwars-names@1.3.0 release
> standard-version "--dry-run" "--preset" "jshint"

✔ bumping version in package.json from 1.3.0 to 1.3.1
✔ bumping version in package-lock.json from 1.3.0 to 1.3.1
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

---
## [1.3.1](https://github.com/alebak/starwars-name/compare/v1.2.1...v1.3.1) (2021-03-05)
---

✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v1.3.1
ℹ Run `git push --follow-tags origin develop && npm publish` to publish

Sorry for spamming, but I don't know if the tests are OK and the results are as expected.

@prokopsimek
Copy link

I am also lf jscs preset.

@jbottigliero
Copy link
Member

Without seeing the git log there is really no way to be certain of whether or not the --dry-run result is correct. It being different (and even empty) for some presets suggests the --preset flag is working, since each preset will define its own configuration for reading commits and writing to the generated CHANGELOG.md.

Based on that, and the additional coverage by #723 – I'm going to close this issue. If you are having problems with a specific preset option value we might need to move that issue over to https://github.com/conventional-changelog/conventional-changelog

@prokopsimek – I can't speak to the history here... but the jscs preset seems to be missing from the monorepo. The original preset was marked deprecated here: https://github.com/conventional-changelog-archived-repos/DEPRECATED-conventional-changelog-jscs. It's possible that configuration was renamed, merged with another preset, or just missed... but that seems like a different issue than the original report here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants