Conventional commits friendly template for SOME nodejs projects.
Create git remote project & clone the remote repo locally.
$ npm init release-it
# Publish a GitHub Release with every release? Yes or
# Where to add the release-it config? › .release-it.json
# release-it.json
{
"git": {
"commitMessage": "chore: release v${version}",
"changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs",
"requireBranch": "main"
},
"hooks": {
"after:bump": "npx auto-changelog -p"
},
"github": {
"release": true
},
"npm": {
"publish": false
}
}
# package.json
"scripts": {
"release": "release-it"
}
$ npm i -D @commitlint/{config-conventional,cli} husky auto-changelog
$ echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
$ npx husky install
$ npx husky add .husky/commit-msg 'npx commitlint --edit $1'
$ npm install -g commitizen cz-conventional-changelog
$ echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
$ git add .
$ git cz # commitizen
$ npm run release
- Create
release.yml
in .github/workflows directory. - The scripts will generate releases automatically after the code has been pushed to Github.
- Refer to this link for the sample workflow.