语义发布 - 在自动生成的发布说明中添加更多部分

Gee*_* VB 1 javascript semantic-release release-notes

我刚刚为我的节点项目设置了语义发布,并用它制作了第一个版本:

发行说明

似乎只提交类型fixfeat添加到发行说明中......我也希望能够显示improvement类型。

有没有办法配置/添加它?谢谢!

小智 5

默认情况下,变更日志文本由常规变更日志角度生成,并在那里确定要包含在变更日志中的提交类型。

https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/writer-opts.js#L45

如果您想在变更日志中包含其他类型的提交,您可以创建自己的预设(基于conventional-changelog-angular),其中将包含所有提交类型。

或者,您可以使用conventional-changelog-conventionalcommits预设,它支持types定义新类型的选项,以及它们是否应包含在发行说明中。

您的语义发布配置将是:

{
  "plugins": [
    ["@semantic-release/commit-analyzer", {
      "preset": "conventionalcommits",
      "releaseRules": [
        {"type": "improvement", "release": "minor"}
      ]
    }],
    ["@semantic-release/release-notes-generator", {
      "preset": "conventionalcommits",
      "presetConfig": {
        "types": [
          {"type": "feat", "section": "Features"},
          {"type": "fix", "section": "Bug Fixes"},
          {"type": "perf", "section": "Performance Improvements"},
          {"type": "revert", "section": "Reverts"},
          {"type": "docs", "section": "Documentation", "hidden": true},
          {"type": "style", "section": "Styles", "hidden": true},
          {"type": "chore", "section": "Miscellaneous Chores", "hidden": true},
          {"type": "refactor", "section": "Code Refactoring", "hidden": true},
          {"type": "test", "section": "Tests", "hidden": true},
          {"type": "build", "section": "Build System", "hidden": true},
          {"type": "ci", "section": "Continuous Integration", "hidden": true},
          {"type": "improvement", "section": "Improvement", "hidden": false}
        ]
      }
    }]
  ]
}
Run Code Online (Sandbox Code Playgroud)

我添加了releaseRules配置,@semantic-release/commit-analyzer因为我假设您想为improvement提交创建一个次要版本。