发布版本自动化记录版本功能方法

# 安装commitizen

npm install --save-dev commitizen

# 初始化Conventional Commits规范适配器

npx commitizen init cz-conventional-changelog --save-dev --save-exact

最后一步,需要在package.json中添加一个script

"scripts": {
   
    ..., // 此处省略其它配置
    "commit": "cz"
}
此时你的package.json应该是这样的:
{
   
  "name": "changelog",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
   
    "test": "echo "Error: no test specified" && exit 1",
    "commit": "cz"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
   
    "commitizen": "^4.2.4",
    "cz-conventional-changelog": "^3.3.0"
  },
  "config": {
   
    "commitizen": {
   
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

使用release-it自动生成变更日志
安装release-it:
npm init release-it

 当前不需要在npm进行发布,因此需要在.release-it.json中添加下面的配置,禁用npm发布:
"npm": {
   
  "publish": false
}

为了兼容当前的提交信息格式,还需要执行下面的指令安装一个插件:
npm install @release-it/conventional-changelog --save-dev

如果想使用angular默认的changelog生成规范,只需要进行下面的配置就可以了:
创建.release-it.json


{
   
  "plugins": {
   
    "@release-it/conventional-changelog": {
   
      "infile": "CHANGELOG.md",
      "ignoreRecommendedBump": true,
      "strictSemVer": true,
      "preset": {
   
        "name": "conventionalcommits",
        "types": [
          {
    "type": "feat", "section": "功能" },
          {
    "type": "fix", "section": "修复BUG" },
          {
    "type": "docs", "section": "文档" },
          {
    "type": "style", "section": "样式" },
          {
    "type": "refactor", "section": "重构" },
          {
    "type": "perf", "section": "性能优化" },
          {
    "type": "test", "section": "测试" }
        ]
      }
    }
  },
  "git": {
   
    "commitMessage": "版本号 v${version}",
    "commit": true,
    "tag": true,
    "push": true
  },
  "npm": {
   
    "publish": false
  }
}

相关推荐

  1. 发布版本自动化记录版本功能方法

    2023-12-27 18:42:04       37 阅读
  2. springcloudalibaba版本发布说明

    2023-12-27 18:42:04       12 阅读
  3. git修改版本发布时间

    2023-12-27 18:42:04       11 阅读
  4. OD Linux发行版本

    2023-12-27 18:42:04       33 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-27 18:42:04       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-27 18:42:04       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-27 18:42:04       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-27 18:42:04       18 阅读

热门阅读

  1. 【超图】SuperMap 模型处理自动化方案 ——目录

    2023-12-27 18:42:04       44 阅读
  2. 董事会在线审批决策任务都在哪里进行?

    2023-12-27 18:42:04       37 阅读
  3. 提升认识能力,远离诈骗

    2023-12-27 18:42:04       35 阅读
  4. 2312llvm,用匹配器构建clang工具

    2023-12-27 18:42:04       35 阅读
  5. 第33期 | GPTSecurity周报

    2023-12-27 18:42:04       32 阅读
  6. 微信小程序的bindtap和catchtap的区别

    2023-12-27 18:42:04       38 阅读
  7. PHP 处理菜单分级树状结构

    2023-12-27 18:42:04       43 阅读