当前位置:网站首页>Standard Version (release and changelog Automation)

Standard Version (release and changelog Automation)

2022-07-19 08:00:00 huangpb0624

We can use  standard-version  Automate version management , Including updates  CHANGELOG.md, And the use of  git tag. It will also be automatically modified package.json Inside version.

In the use of standard-version Before , Need to follow Conventional Commit Specifications To standardize commit message To write . This is because standard-version Is based on commit Type to update the version number (feature Will update minor, bug fix Will update patch, BREAKING CHANGES Will update major).

here , We can use  commitizen To standardize commit message To write , Specific configuration process See .
commitizen After configuration , We can start to configure  standard-version  了 .

 1. install

npm install -D standard-version

2. stay  package.json  Script the response in :

"scripts": {
  "release": "standard-version"
}

For reasonable use  standard-version, First of all, we need  git add .  file , And then execute  npm run commit Submit , Finally, execute  npm run release.

After execution, it will be automatically generated in the project root directory  CHANGELOG.md file .

CHANGELOG.md To configure

By default ,standard-version Only in CHANGELOG.md It's recorded in feat and fix Submission of type . If you want to record other types of submissions , The following steps are required :

  • Create a file named... At the root of the project .versionrc The file of , Paste and copy the content :
{
  "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 type
  • "section" Different commit Type CHANGELOG.md Area in
  • "hidden" Whether in CHANGELOG.md It shows that


 

Reference resources : Use commitizen and standard-version automation JavaScript Project version control - Simple books

原网站

版权声明
本文为[huangpb0624]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207170541059517.html