I am using husky
and commitLint
to check the commit messages in one of the repo's I work.
package.json
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
pretty straightforward. However, as I don't wanna create a barrier for the less experienced developers of my team I wanna run a CLI to help them format their commit message IF the hook "commit-msg" fails because of bad formatting.
So, I tried the following "commit-msg": "commitlint -E HUSKY_GIT_PARAMS &> /dev/null || npx git-cz"
and it executes the second command, but it also closes the cli right after running it.
So, any idea how to implement such thing ?