Package Exports
- @commitlint/cz-commitlint
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@commitlint/cz-commitlint) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Commitizen adapter using the commitlint.config.js
@commitlint/cz-commitlint
This is a commitizen adapter, using this adapter, commitizen works based on commitlint.config.js.
Submit by commitizen, lint by commitlint, just need maintain one configuration file, Consistent and Scalable.
The interactive process is inspired by cz-conventional-changelog.
Getting started
Using commitizen adapter
npm install --save-dev @commitlint/cz-commitlint commitizenIn package.json
{
"scripts": {
"commit": "git-cz"
},
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"
}
}
}Configure commitlint
# Install commitlint cli and conventional config
npm install --save-dev @commitlint/config-conventional @commitlint/cli
# Simple: config with conventional
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js
# commitlint configuration is shareable,
# Install lerna-scopes
npm install --save-dev @commitlint/config-lerna-scopes
# Scalable: config with lerna-scopes in monorepo mode
echo "module.exports = {extends: ['@commitlint/config-conventional', '@commitlint/config-lerna-scopes']};" > commitlint.config.jsSet Git Hooks by husky
# ------- using npm ----------
# Install Husky
npm install husky --save-dev
# Active hooks
npx husky install
# Add commitlint hook
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1'
# Add commitizen hook
npx husky add .husky/prepare-commit-msg 'exec < /dev/tty && node_modules/.bin/cz --hook || true'
# ------- using yarn ----------
# Install Husky
yarn add husky --dev
# Active hooks
yarn husky install
# Add commitlint hook
yarn husky add .husky/commit-msg 'yarn --no-install commitlint --edit $1'
# Add commitizen hook
yarn husky add .husky/prepare-commit-msg 'exec < /dev/tty && node_modules/.bin/cz --hook || true'
Try it out
git add .
npm run commit
# or
yarn run commitRelated
- Commitlint Shared Configuration - You can find more shared configurations are available to install and use with commitlint