I'd like to use huksy and commitlint to my angular project.
How can I achieve this ?
npm i husky --save-dev
npx husky init
The init command simplifies setting up husky in a project. It creates a pre-commit script in .husky/ and updates the prepare script in package.json. Modifications can be made later to suit your workflow. Husky doc
init
pre-commit
.husky/
prepare
package.json
npm i @commitlint/cli @commitlint/config-conventional --save-dev
commitlint.config.js
module.exports = { extends: ['@commitlint/config-conventional'], };
.husky
commit-msg
#!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" npx --no-install commitlint --edit "$1"
test
git commit -m "Keep calm and commit"
Copyright © 2021 Jogjafile Inc.
Install Husky
npm i husky --save-devnpx husky initInstall commitlint
npm i @commitlint/cli @commitlint/config-conventional --save-devcommitlint.config.jsfile at the root of the project..huskyfolder, addcommit-msgfilepre-commitfile if you do not have anytestTest it
git commit -m "Keep calm and commit"