当前位置:网站首页>standard-version(发版与 Changelog 自动化)
standard-version(发版与 Changelog 自动化)
2022-07-17 05:41:00 【huangpb0624】
我们就可以使用 standard-version 进行版本管理自动化,包括更新 CHANGELOG.md,以及使用 git tag。它也会自动修改 package.json 里的 version。
在使用 standard-version 之前,需要遵循 Conventional Commit Specifications 来进行标准化的 commit message 编写。这是因为 standard-version 是基于 commit 类型来更新版本号的(feature 会更新 minor, bug fix 会更新 patch, BREAKING CHANGES 会更新 major)。
这里,我们可以借助 commitizen 来进行标准化的 commit message 编写,具体配置流程详见。
commitizen 配置好后,我们可以开始配置 standard-version 了。
1. 安装
npm install -D standard-version2. 在 package.json 中编写响应的脚本:
"scripts": {
"release": "standard-version"
}为了合理的使用 standard-version,我们首先需要 git add . 文件,然后执行 npm run commit 提交,最后执行 npm run release。
执行完以后就会在项目根目录自动生成 CHANGELOG.md文件。
CHANGELOG.md 配置
默认情况下,standard-version 只会在 CHANGELOG.md 中记录 feat 和 fix 类型的提交。如果想记录其他类型的提交,需要如下步骤:
- 在项目的根目录下创建一个名为
.versionrc的文件,并粘贴复制一下内容:
{
"types": [
{"type": "chore", "section":"Others", "hidden": false},
{"type": "revert", "section":"Reverts", "hidden": false},
{"type": "feat", "section": "Features", "hidden": false},
{"type": "fix", "section": "Bug Fixes", "hidden": false},
{"type": "improvement", "section": "Feature Improvements", "hidden": false},
{"type": "docs", "section":"Docs", "hidden": false},
{"type": "style", "section":"Styling", "hidden": false},
{"type": "refactor", "section":"Code Refactoring", "hidden": false},
{"type": "perf", "section":"Performance Improvements", "hidden": false},
{"type": "test", "section":"Tests", "hidden": false},
{"type": "build", "section":"Build System", "hidden": false},
{"type": "ci", "section":"CI", "hidden":false}
]
}
"type"commit 类型"section"不同的 commit 类型所在 CHANGELOG.md 中的区域"hidden"是否在 CHANGELOG.md 中显示
参考:使用 commitizen 和 standard-version 自动化 JavaScript 项目版本控制 - 简书
边栏推荐
- MySQL 02 function substr mod view view
- Web Security (XSS and CSRF)
- [operation rules] how to realize TSN system level test?
- PCIe bus architecture high performance data preprocessing board / K7 325t FMC interface data acquisition and transmission card
- Redis源码分析之双索引机制
- 环境变量和文件夹放置位置
- Xiaoyi and you talk about how to realize c-v2x HIL test in v2x test series (2022 version)
- Pytorch随记(3)
- Jenkins如何设置邮箱自动发送邮件?
- 卷积神经网络CNN
猜你喜欢
随机推荐
导出文件or下载文件
Spark3.x-practical double flow join (window and redis implementation method and template code)
Flink introduction to practice - phase II (illustrated runtime architecture)
PyCharm 界面设置
Flink入门到实战-阶段二(图解运行时架构)
SSM integration
fiddler 抓包工具使用
Use Altium designer software to draw a design based on stm32
day01(Flume)
SCI论文的Highlights怎么写(正经的教你怎么写)
Spark3.x入门到精通-阶段七(spark动态资源分配)
利用PCA来简化数据
【MySQL】 事务:事务基础知识、MySQL事务实现原理、事务日志 redolog & undolog 详解
@How can conditionalonmissingbean cover beans in third-party components
Spark introduction to proficient - external part (operation and maintenance and simple operation of standaone cluster)
Redis 跳跃表实现原理 & 时间复杂度分析
Regular expression extraction of matching content
Pytorch随记(3)
Maxwell简介&使用
Pycharm interface settings









