# 依赖安装
# 1. 生成commit信息
npm install --save-dev commitizen
npx commitizen init cz-conventional-changelog --save-dev --save-exact
package.json
"scripts": {
"commit": "git-cz"
}
# 2. commit校验
npm install --save-dev @commitlint/config-conventional @commitlint/cli
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
修改文件commitlint.config.js为正常格式
# 3. 更新版本、生成changelog、打tag
npm i --save-dev standard-version
package.json
"scripts": {
"release": "standard-version"
}
# 使用步骤
git pull
git add .
npm run commit
npm run release -- --prerelease
git push --follow-tags origin master
# 参考
https://juejin.im/post/5cea2c4bf265da1b6836993f https://juejin.im/post/5cc4694a6fb9a03238106eb9