Skip to content

commitizen uses wrong version of cz-conventional-changelog #478

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

Closed
rifler opened this issue Apr 18, 2018 · 2 comments · Fixed by #484
Closed

commitizen uses wrong version of cz-conventional-changelog #478

rifler opened this issue Apr 18, 2018 · 2 comments · Fixed by #484

Comments

@rifler
Copy link

rifler commented Apr 18, 2018

In my package.json:

...
"commitizen": "2.9.6",
"cz-conventional-changelog": "^2.1.0"
...

<projectDir>/.czrc:

{ "path": "cz-conventional-changelog" }
# I've also tried
# { "path": "./node_modules/cz-conventional-changelog" }

Then I run npm run cz (it is just simply git-cz) and get these questions:

? Select the type of change that you're committing: feat:     A new feature
? Denote the scope of this change ($location, $browser, $compile, etc.):
 
? Write a short, imperative tense description of the change:
 asd
? Provide a longer description of the change:
 qweqwe
? List any breaking changes or issues closed by this change:

Questions about breaking changes and issues are combined into one, but I googled, that in one of the new releases of cz-conventional-changelog this behaviour was changed - commitizen/cz-conventional-changelog#44

Ok, let's grep old combined message

grep -r "List any breaking changes or issues closed by this change" ./node_modules 

./node_modules/commitizen/node_modules/cz-conventional-changelog/engine.js:          message: 'List any breaking changes or issues closed by this change:\n'

And some code from related pull request

grep -r "breaking = breaking ? 'BREAKING CHANGE: ' + breaking.replace" ./node_modules

./node_modules/cz-conventional-changelog/engine.js:        breaking = breaking ? 'BREAKING CHANGE: ' + breaking.replace(/^BREAKING CHANGE: /, '') : '';

Then I noticed debug messages from commitizen:

npm run cz --loglevel=error

> @[email protected] cz /Users/rifler/Documents/projects/my-project
> git-cz

[email protected], [email protected] // <---this line


Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.

? Select the type of change that you're committing: (Use arrow keys)

Why does it use 1.2.0, while I have 2.1.0 in ./node_modules/cz-conventional-changelog ?
It turns out that commitizen uses wrong version of cz-conventional-changelog - it own version, but not installed by myself.
Can you please help me with this strange behaviour ?
Thanks in advance

@rifler
Copy link
Author

rifler commented Apr 18, 2018

I've also tried ./node_modules/.bin/git-cz instead of npm run cz

./node_modules/.bin/git-cz 
[email protected], [email protected]

@travi
Copy link
Contributor

travi commented May 23, 2018

although this is the documented suggestion for configuration, i don't understand how it would have ever worked to put the configuration in a .czrc file.

since the priority of config files gives package.json the highest priority, and the first existing file is used to pull out the config regardless of commitizen config actually existing in the file, it seems like this would always happen when config is not defined in package.json because it will fall back to config in your home directory when the config file it tried to read (always package.json since it will exist in all projects). my global config defines cz-conventional-changelog, which is don't have installed globally intentionally, but is a dependency of commitizen, which i do. notice that the version aligns with the incorrect version in @rifler's experience above:

i noticed this inconsistency a long time ago when i first started using commitizen, but switched to the format used by the init command and didn't investigate deeply enough at the time. i recently ran into a problem when config is defined in the package.json, so i've reconsidered using the .csrc file again, only to find that it doesn't work.

travi added a commit to travi/cz-cli that referenced this issue May 23, 2018
since package.json was prioritized first, it is always found and always used, even if it does not contain commitizen config. the other optional config files are never found as a result. this change looks for the optional files first and only lands on the package.json if the other files do not exist

fixes commitizen#478
jimthedev pushed a commit that referenced this issue May 24, 2018
…les (#484)

since package.json was prioritized first, it is always found and always used, even if it does not contain commitizen config. the other optional config files are never found as a result. this change looks for the optional files first and only lands on the package.json if the other files do not exist

fixes #478
scttcper referenced this issue in scttcper/ngx-color Jun 19, 2018
This Pull Request updates dependency [commitizen](https://github.com/commitizen/cz-cli) from `v2.9.6` to `v2.10.1`

**Note**: This PR was created on a configured schedule ("before 3am on Monday") and will not receive updates outside those times.


<details>
<summary>Release Notes</summary>

### [`v2.10.1`](https://github.com/commitizen/cz-cli/releases/v2.10.1)
[Compare Source](commitizen/cz-cli@v2.10.0...v2.10.1)
<a name"2.10.1"></a>
##### 2.10.1 (2018-05-24)
##### Bug Fixes

* **cli:** Respect git commit -a original behavior (#&#8203;376) (#&#8203;471) ([d10c94f4](commitizen/cz-cli@d10c94f4))
* **config:** prioritized package.json last when looking for config files (#&#8203;484) ([5f8902e7](commitizen/cz-cli@5f8902e7), closes [#&#8203;478](`https://github.com/commitizen/cz-cli/issues/478`))

---

### [`v2.10.0`](https://github.com/commitizen/cz-cli/releases/v2.10.0)
[Compare Source](commitizen/cz-cli@v2.9.6...v2.10.0)
<a name"2.10.0"></a>
#### 2.10.0 (2018-05-24)
##### Bug Fixes

* lodash Node Security warning (#&#8203;482) ([0023958e](commitizen/cz-cli@0023958e))
* **adapter:** Don't print git root to stdout (#&#8203;428) ([d5e24245](commitizen/cz-cli@d5e24245))
* **cli:** Don't print error stack trace if git-cz failed (#&#8203;436) (#&#8203;437) ([53719a42](commitizen/cz-cli@53719a42))
##### Features

* **strategies:** respect the `--allow-emtpy` flag (#&#8203;477) ([495437c1](commitizen/cz-cli@495437c1))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants