3

我刚刚为我的节点项目设置了语义发布并使用它进行了第一个发布:

发行说明

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

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

4

1 回答 1

7

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

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

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

或者,您可以使用常规更改日志常规提交预设,该预设支持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}
        ]
      }
    }]
  ]
}

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

于 2019-11-28T17:48:39.423 回答