-
Notifications
You must be signed in to change notification settings - Fork 553
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
precommit runs twice when using husky #432
Comments
Can you post what your workflow looks like without commitizen in the mix
including when and how you run git add and git commit in this configuration?
…--
Jim ForCy
On May 2, 2017 at 3:42:08 AM, James Gillmore ***@***.***) wrote:
Here's my relevant package.json:
"devDependencies": {
"commitizen": "^2.9.6",
"cz-conventional-changelog": "^2.0.0",
"husky": "^0.13.2",
"lint-staged": "^3.4.0",
"prettier": "^1.2.2"
},"scripts": {
"precommit": "lint-staged --verbose",
"commit": "git-cz",
},"lint-staged": {
"*.js": [
"prettier --single-quote --semi=false --write",
"git add"
]
},"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
lint-staged is called once before the commitizen command line form
appears, and husky - npm run -s precommit is run after. Typically without
commitizen only lint-staged is called. Somehow commitizen is triggering
husky to be called. No where do I have this script: npm run -s precommit.
It seems commitizen somehow triggers it after you complete the form.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#432>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGpinNk5OrShdPajuyOF6g25wGcD21Mks5r1uxggaJpZM4NN3Qk>
.
|
I simply call Whereas if you run
Basically it seems 2 different versions of ps. when is the precommit hook supposed to run relative to Commitizen? Before or after? Because it seems perhaps the correct hook is running after the form, as it has the same log as without commitizen. So perhaps what we want is the 2nd hook, but only to run before the commitizen form. |
Here's a package you can clone and immediately see it in action: |
That is a bug in husky that happens due to a "feature" of npm-scripts that auto run scripts with the name prexxx where xxx is the name of another script. So, because you're using Until husky fixes this you can simply change your commitizen task to We could probably update our docs to reflect that when using commitizen and husky you should pick another name than |
nice find! Here's the PR as requested: #433 |
Developer can run it, if desired, using `npx cz`. Also there are known issues using Husky and Commitizen together - commitizen/cz-cli#558 (comment) - commitizen/cz-cli#432 (wont fix) - typicode/husky#99
Here's my relevant
package.json
:lint-staged
is correctly called once before thecommitizen
command line form appears, and then incorrectlyhusky - npm run -s precommit
is run after. Typically withoutcommitizen
onlylint-staged
is called. Somehowcommitizen
is triggeringhusky
to be called. No where do I have this script:npm run -s precommit
. It seemscommitizen
somehow triggers it after you complete the form.The text was updated successfully, but these errors were encountered: