logo My Digital Garden

Generate CHANGELOG.md and enforce commit message standards.

By James Kolean on Nov 14, 2021
Source repository: https://gitlab.com/jameskolean/commit-lint
Dev OpsJavaScriptTools
banner

I’m pressed for time today, so I’m only including the README.md. I’m not going to add much in the way of explanation. The document should be sufficient to help my future self remember how to do this. I played with many tools that Didn’t do what I wanted until arriving at this setup.

Note: After you clone the project be sure to run

yarn
yarn husky install

Install

Commitlint

yarn add -D @commitlint/cli @commitlint/config-conventional
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js

Husky

yarn add husky --D
yarn husky install
yarn husky add .husky/commit-msg 'yarn commitlint --edit $1'

Commitizen prompt

 yarn add -D @commitlint/cz-commitlint commitizen
 yarn add @commitlint/config-conventional @commitlint/cli -D

Add to package.json

{
  "scripts": {
    "commit": "git-cz"
  },
  "config": {
    "commitizen": {
      "path": "@commitlint/cz-commitlint"
    }
  }
}

Try it

git commit -m "invalid commit message"
git commit -m "chore: valid commit message"
yarn commit

Reference

Auto-Changelog

npm install -g auto-changelog
yarn auto-changelog -p

reference -https://www.npmjs.com/package/auto-changelog

Generate-Changelog

yarn add generate-changelog -D
yarn changelog

reference

© Copyright 2024 Digital Garden cultivated by James Kolean.