Skip to content

Instantly share code, notes, and snippets.

@Rankarusu
Last active March 4, 2023 19:29
Show Gist options
  • Save Rankarusu/5e67ccf65ab5ad81555fcf1872d0728d to your computer and use it in GitHub Desktop.
Save Rankarusu/5e67ccf65ab5ad81555fcf1872d0728d to your computer and use it in GitHub Desktop.
Setup Commitizen and CommitLint

Setup

kudos to this guide

Install commitlint cli and conventional config

npm i -D @commitlint/config-conventional @commitlint/cli

Configure commitlint to use conventional config

echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.cjs

Install husky

npm i -D husky

Active hooks

npx husky install

Add hook

npx husky add .husky/commit-msg 'npx --no -- commitlint --edit $1'

Install commitizen

npm i -D commitizen @commitlint/cz-commitlint inquirer

add this to your package.json

  "scripts": {
    "release": "standard-version --no-verify"
    // use --no-verify to skip git hooks we'll introduce later
  }

Install standard-version

npm i -D standard-version

install commitizen globally

npm install commitizen -g

initialize the changelog

commitizen init cz-conventional-changelog --save-dev --save-exact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment