Skip to content

Instantly share code, notes, and snippets.

@wojtekmaj
Last active December 27, 2021 10:00
Show Gist options
  • Save wojtekmaj/0b2c9bb53813e4240221358d8408bfcb to your computer and use it in GitHub Desktop.
Save wojtekmaj/0b2c9bb53813e4240221358d8408bfcb to your computer and use it in GitHub Desktop.
Install Husky & commitlint with conventional config using Yarn Berry
git fetch
git checkout main
git pull
git checkout -b husky
yarn add @commitlint/config-conventional @commitlint/cli husky@^7.0.0 --dev
yarn dedupe
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
# if you're on windows, check EOL sequence in the file created
yarn husky install
yarn husky add .husky/commit-msg 'yarn commitlint --edit "$1"'
# if you're on windows, you need to make sure chmod is set correctly
git update-index --chmod=+x .husky/commit-msg
npm set-script postinstall "husky install"
# you might want to sort your scripts at this point as set-script adds it at the end
git add .
git commit -m "Add husky and commitlint with conventional config"
git push --set-upstream origin husky
git checkout main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment