To set up Commitizen in your project, first install the necessary packages:
"dependencies": {
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0"
}
Next, add the configuration to your package.json
:
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
Finally, add a script to facilitate committing:
"scripts": {
"commit": "git-cz"
}
Now, you can run npm run commit
to initiate the Commitizen prompt, ensuring your commit messages follow the conventional format.