A practical guide for setting up a Conventional Commits workflow with Husky, Commitlint and Commitizen.
Instead of configuring Husky, Commitlint, Commitizen and Release Please individually, this guide shows how to combine them into a complete Conventional Commits workflow.
feat(auth): add OAuth login
fix(api): prevent duplicate requests
docs(readme): improve installation guide
- Validate commit messages against the Conventional Commits specification.
- Create commit messages interactively with Commitizen.
- Automate releases and
CHANGELOG.mdgeneration. - Keep version numbers in sync with your release history.
Install the necessary dependencies locally:
yarn add --dev husky @commitlint/cli @commitlint/config-conventional cz-conventional-changelogInstall Commitizen globally to enable standardized commit message formatting:
sudo yarn global add commitizenUpdate your project's package.json file to configure Commitizen:
{
...
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog",
"disableScopeLowerCase": true
}
},
...
}Create a commitlint.config.js file in your project root directory to configure Commitlint:
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"scope-case": [0],
},
};npx husky initAutomate release management with Release Please:
Deploy release-please with GitHub Action by creating a .github/workflows/release-please.yml file with these contents:
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
package-name: release-please-actionMake sure you have the correct Workflow permissions on your repository (Settings > Actions > General):
Standard Commit simplifies the process of writing standardized commit messages:
Instead of git commit, use git cz to open a wizard and generate a standardized commit message:
git add .
git cz
git push --follow-tagsYou can still use git commit ... but the commit will fail if the commit message is not properly formatted.
git add .
git commit -m "feat(blog): add comment section"
git push --follow-tags- commitizen helps format commit messages with a series of prompts
- husky will trigger the commitlint on each commit
- commitlint checks if your commit messages meet the Conventional Commits specification
- release-please automates
CHANGELOG.md, bump the version and generate a new release
Want to contribute? All contributions are welcome. Read the contributing guide.
Questions, suggestions and bug reports are welcome. Feel free to open an issue.
This project is licensed under the MIT License. See the LICENSE file for details

