Verifies the format of a commit message. Intended to be used with simple-git-hooks.
- Install packages:
npm i -D simple-git-hooks
- Add
postinstall
script and add acommit-msg
hook to package.json:
{
"scripts": {
"postinstall": "simple-git-hooks"
},
"simple-git-hooks": {
"commit-msg": "npx @n6ai/verify-commit-msg@latest $1"
}
}
- Register Git Hooks:
npm i
Messages must be matched by the following regex:
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|build|ci|chore|types|release|deps)(\(.+\))?(\!)?: .{1,50}/