Changelog.md 中文文档教程

发布于 7年前 浏览 344 项目主页 更新于 3年前

changelog.md

NPM 版本NPM 下载构建状态donate

preview

How does it work

  • Get last version from git tag, if no tags it defaults to 0.0.0
  • Get the commits since last version
  • Prompt user to enter the type of each commit
  • Infer the new version from the types of all commits
  • Generate markdown string from commits and prompt answers
  • Create or prepend to CHANGELOG.md and update package.json version field
  • Commits changes and create new git tag

Install

$ yarn global add changelog.md

Usage

$ changelog

Recipes

Commit types

  • patch: Bug fixes
  • minor: Backward-compatible updates
  • major: Introducing breaking changes
  • ignore: Do not include this commit in changelog

除了在提示中选择 ignore 以从 changelog 中排除提交外,以 ignore: 开头的提交消息也将被排除。

你也可以使用type: message这样的格式来预定义commit类型,它们会被转换为我们使用的commit类型:

semantic typedescriptioncommit type0.y.z
chorechanges to build processignore
docsdocumentation only changesignore
feata new featureminorpatch
fixbug fixpatch
refactorcode refactorpatch
stylecode style changesignore
testadd missing testsignore
breakingintroduce breaking changesmajorminor
perfperformance improvementspatch
tweaksdon't know how to describepatch

注意:在0.yz版本中,major更改会影响 y,其他更改和补丁会影响 z。 所以在这种情况下你永远无法达到 1.0.0 是吗? 然后明确指定下一个版本的版本,例如:changelog 1.0.0

对于 tweaks: subject,一条消息只有 tweaks 或 < code>tweak 也将是一个补丁。

您不必在提交消息中使用这些类型,因为您可以在实际运行 changelog 时一一设置它们(仅适用于 CHANGELOG.md,不会更新提交本身)。

Work with npm publish

# made some changes to your code...
$ git commit -am "feat: change the world"
$ npm test
$ changelog
$ git push --follow-tags
$ npm publish

Projects using this

  • SAO: ⚔️ Futuristic scaffolding tool.
  • docute: Effortlessly documentation done right.
  • welcome to add your project here…

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

changelog.md © EGOIST,根据 MIT 许可证。
由 EGOIST 在贡献者 (list) 的帮助下创作和维护。

egoistian.com · GitHub @EGOIST · 推特 @remrinrin

changelog.md

NPM versionNPM downloadsBuild Statusdonate

preview

How does it work

  • Get last version from git tag, if no tags it defaults to 0.0.0
  • Get the commits since last version
  • Prompt user to enter the type of each commit
  • Infer the new version from the types of all commits
  • Generate markdown string from commits and prompt answers
  • Create or prepend to CHANGELOG.md and update package.json version field
  • Commits changes and create new git tag

Install

$ yarn global add changelog.md

Usage

$ changelog

Recipes

Commit types

  • patch: Bug fixes
  • minor: Backward-compatible updates
  • major: Introducing breaking changes
  • ignore: Do not include this commit in changelog

Besides choosing ignore in prompts to exclude commits from changelog, the commit message that starts with ignore: will also be excluded.

You can also use format like type: message to pre-define commit type, they will be converted to the commit type we use:

semantic typedescriptioncommit type0.y.z
chorechanges to build processignore
docsdocumentation only changesignore
feata new featureminorpatch
fixbug fixpatch
refactorcode refactorpatch
stylecode style changesignore
testadd missing testsignore
breakingintroduce breaking changesmajorminor
perfperformance improvementspatch
tweaksdon't know how to describepatch

Note: in 0.y.z versions, major changes will affect y, other changes and patches will affect z. So in such situation you can never reach 1.0.0 do you? Then just explicitly specific the version for your next release, like: changelog 1.0.0

For tweaks: subject, a message with only tweaks or tweak will also be a patch.

You don't have to use these types in your commit message since you can set them one by one when actually running changelog (only for CHANGELOG.md, will not update the commit itself).

Work with npm publish

# made some changes to your code...
$ git commit -am "feat: change the world"
$ npm test
$ changelog
$ git push --follow-tags
$ npm publish

Projects using this

  • SAO: ⚔️ Futuristic scaffolding tool.
  • docute: ???? Effortlessly documentation done right.
  • welcome to add your project here…

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

changelog.md © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).

egoistian.com · GitHub @EGOIST · Twitter @remrinrin

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文