@magikbee/commitlint-config-magikbee

1.0.11 • Public • Published

commitlint config for node projects

This package is used to force the standardisation of commits.

[commitlint][https://commitlint.js.org/#/] - a tool that checks and validates commit messages based on predefined rules. It can ensure that commit messages follow a specific format and style, usually using semantic conventions.

[commitzen][https://github.com/commitizen/cz-cli] - to present an interactive interface to guide the developer in choosing the commit type, scope, description and other information.

The commitlint configuration is based on [conventional commits][https://www.conventionalcommits.org/en/v1.0.0/].

Commitzen is configured to use the same configuration as commitlint via the [@commitlint/cz-commitlint][https://www.npmjs.com/package/@commitlint/cz-commitlint] package. This prevents possible configuration problems.

Installing

  1. In your project folder, run:
npm install --save-dev @magikbee/commitlint-config-magikbee @commitlint/cli@^17.7.1 @commitlint/config-conventional@^17.7.0 @commitlint/cz-commitlint@^17.7.1 commitizen@^4.3.0 husky@^8.0.3 inquirer@^8.2.6
  1. Create (or update) a commitlint.config.js file in your project folder with the following content:
module.exports = {
  extends: ['@magikbee/commitlint-config-magikbee']
};
  1. Add commitizen config to package.json file
"config": {
    "commitizen": {
      "path": "@commitlint/cz-commitlint"
    }
  }
  1. Add script to package.json file to call commit helper
"commit": "git-cz"

Add husky

  1. Install
npm install --save-dev husky@^8.0.3 
  1. Activate hooks
npx husky install
  1. Add hook (to run commitlint and check syntax before adding the commit)
npx husky add .husky/commit-msg  'npx --no -- commitlint --edit ${1}'
  1. Add hook (to use the commit helper when using git commit)

NOTE

It should not be used in conjunction with the standard version package.


npx husky add .husky/prepare-commit-msg "exec < /dev/tty && npx cz --hook || true"
  1. To automatically have Git hooks enabled after install, edit package.json
"scripts": {
    "postinstall": "husky install"
}

Optional - Bump version, generate changelog, create final commit and create a tag

  1. Install standard version
npm i --save-dev standard-version
  1. Add an npm run script to your package.json
{
  "scripts": {
    "release": "standard-version"
  }
}

Now you can use npm run release.

For your first release, simply do npm run release -- --first-release.

Readme

Keywords

none

Package Sidebar

Install

npm i @magikbee/commitlint-config-magikbee

Weekly Downloads

37

Version

1.0.11

License

MIT

Unpacked Size

6.72 kB

Total Files

7

Last publish

Collaborators

  • magikbee