Last active
January 13, 2024 12:42
-
-
Save gryzinsky/8c7f4fd46adedb9411a6fd0515560fac to your computer and use it in GitHub Desktop.
Install Husky with Commitizen and Commitlint Using Yarn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
############################################## | |
################ Instructions ################ | |
############################################## | |
# Create a script called husky.sh in | |
# your project root directory and run: | |
# | |
# $ chmod u+x husky.sh | |
# | |
# After that, remove husky.sh and profit! | |
# Install husky and commitizen | |
yarn add -D husky commitizen | |
# Init husky | |
yarn husky install | |
# Init conventional changelog | |
yarn commitizen init cz-conventional-changelog --save-dev --save-exact | |
# Install | |
yarn install && rm package-lock.json | |
# Add hook for prepare-commit-msg | |
yarn husky add .husky/prepare-commit-msg "exec < /dev/tty && node_modules/.bin/cz --hook || true" | |
# Install commitlint | |
yarn add -D @commitlint/{config-conventional,cli} | |
# Configure commitlint | |
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js | |
# Install commit-msg hook | |
yarn husky add .husky/commit-msg "npx --no-install commitlint --edit \$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment