commitizen / cz-cli

The commitizen command line utility. #BlackLivesMatter
http://commitizen.github.io/cz-cli/
MIT License
16.66k stars 548 forks source link

husky doesn't cause issues with script named commit #684

Open OmgImAlexis opened 4 years ago

OmgImAlexis commented 4 years ago

This section from the README doesn't seem valid anymore. I've been using a script called "commit" with a husky "precommit" hook without any issues.

Unless I'm missing something this can be removed.

NOTE: if you are using precommit hooks thanks to something like husky, you will need to name your script some thing other than "commit" (e.g. "cm": "git-cz"). The reason is because npm-scripts has a "feature" where it automatically runs scripts with the name prexxx where xxx is the name of another script. In essence, npm and husky will run "precommit" scripts twice if you name the script "commit," and the work around is to prevent the npm-triggered precommit script.
codyzu commented 4 years ago

I was just reading over the docs and was wondering if that was still accurate. It is probably due to the change in the husky config starting with husky 1.0.0. Husky no longer relies on the package.json scripts and instead its dedicated config in the package.json.

I haven't validated, but when I add cz-cli to my new repo, if I have time I'll put together a PR for this.