@meludi/conventional-commits-config
v1.0.0
Published
Shareable conventional commits configuration
Downloads
22
Maintainers
Readme
@meludi/conventional-commits-config
Shareable conventional commits configuration based on conventional commits.
Install
$ npm i -D @meludi/conventional-commits-config
Prepare
Husky
Edit package.json
> prepare script and run it once:
$ npm pkg set scripts.prepare="is-ci || husky install"
$ npm run prepare
lint-staged
Add the following to your package.json
:
...
"lint-staged": {
"*.js": "eslint .",
"*": "your_command",
...
}
Add husky hooks and scripts:
$ npx husky add .husky/pre-commit "npm run pre-commit"
$ npm pkg set scripts.pre-commit="lint-staged"
commitlint and commitizen
Create a commitlint.config.js
configuration file in the root of your project and add the following to it:
// commitlint.config.js
module.exports = require('@meludi/conventional-commits-config/commitlint.config');
Add the following to your package.json
:
...
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
}
Add husky hooks and scripts:
# commitlint
$ npx husky add .husky/commit-msg "npm run commitlint"
$ npm pkg set scripts.commitlint="commitlint --edit \$1"
# commitizen
$ npm pkg set scripts.commit="git cz"
Run it:
$ npm run commit
Recommendation
semantic-release - Fully automated version management and package publishing:
Setup Semantic Release on your GitHub repo
- Create npm token using
npm token create
or https://www.npmjs.com/settings/YOUR_ACCOUNT_NAME/tokens - Add
NPM_TOKEN
to GitHub repo:Settings -> Secret and variables -> Secrets
- Set write permission to GitHub repo:
Settings -> Actions - General -> Workflow permissions -> Read and write permission
- Set
version
to0.0.0-semantic-release
in package.json
GitHub Actions Example
configuration for Node projects