Kamyab7 / ConventionalCommits

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conventional Commit

I try use Conventional Commit and for enforcing its rule I use conventional-changelog/commitlint and typicode/husky with a pre-commit hook. For read more about its setup see commitlint docs and this article.

Here I configured a husky hook for conventional commits:

  1. Install NPM:
npm init
  1. Install Husky:
npm install husky --save-dev
  1. Add prepare command for installing and activating husky hooks in the package.json file:
npm pkg set scripts.prepare="husky install"
  1. Install CommitLint:
npm install --save-dev @commitlint/config-conventional @commitlint/cli
  1. Create the commitlint.config.js file with this content:
module.exports = { extends: '@commitlint/config-conventional']};
  1. Create the Husky folder:
mkdir .husky
  1. Link Husky and CommitLint:
# this command should run in git-bash
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
  1. Activate and installing all husky hooks with this command:
npm run prepare

About


Languages

Language:JavaScript 67.7%Language:HTML 22.6%Language:Shell 9.7%