1. Install standard-version (Making the address)

NPM install -d standard-version or yarn add -d standard-versionCopy the code

2. Automatically upgrade the version number and generate changelog and tag

1. Add the package.json script command
// package.json
"scripts": {
    // ...
    "release": "standard-version"
}
Copy the code
2. Run the yarn release or NPM run releas command

The CHANGELOG file is as follows. The submission record will be written into the CHANGELOG file. By default, only the submission records of feat and fix are written.

3. Use the. Versionrc configuration to write more types of submission records to CHANGELOG
{"types": [{"type": "chore", // Type "section": "Other", // The category name "hidden" in the CHANGELOG file: False // Whether it is not displayed in CHANGELOG}]}Copy the code

3. Push the tag to the remote

// package.json
"scripts": {
    // ...
   // "release": "standard-version"
   "release": "standard-version && git push --follow-tags"
}
Copy the code

Before the project is released, you only need to run YARN Release to upgrade the version number, update the CHANGELOG, and create a new tag