To make my configurations a bit easier I share my Commitlint config.
Another notable tool for using Conventional Commits is cz-git.
npm install -D @mheob/commitlint-config
yarn add -D @mheob/commitlint-config
pnpm add -D @mheob/commitlint-config
bun add -D @mheob/commitlint-config
Add this config to your root package.json
.
{
"config": {
"commitizen": {
"path": "node_modules/cz-git"
}
}
}
Now create a .commitlint.config.js
file in the root of your project with this content:
/** @type {import('cz-git').UserConfig} */
module.exports = {
...require('@mheob/commitlint-config'),
};
If you want to use your own scopes or if you need to override some settings you can do it in the commitlint.config.js
this way:
const fs = require('node:fs');
const path = require('node:path');
const defaultConfig = require('@mheob/commitlint-config');
// dynamically define the scopes
const apps = fs.readdirSync(path.resolve(__dirname, 'apps'));
const packages = fs.readdirSync(path.resolve(__dirname, 'packages'));
/** @type {import('cz-git').UserConfig} */
module.exports = {
...defaultConfig,
prompt: {
...defaultConfig.prompt,
scopes: ['deps', 'release', 'repo', ...apps, ...packages],
useEmoji: false,
},
};