git upgrade project version and generate changelog

Keywords: PHP git npm GitLab github

Semantic Version Control Specification
Contract Submission
Node.js
NPM
Taobao NPM Mirror
Commitizen
conventional-changelog-cli

introduce

  • Semantic Version Control
  • Contract Submission
  • Noun Interpretation
  • Demonstration

Plug-in unit

1. Install Node.js

2. Install cnpm (Taobao NPM mirror)

$ npm install -g cnpm --registry=https://registry.npm.taobao.org

3. Install version generation tools

$ cnpm install -g standard-version

New project using version number: 0.1.0

$ standard-version -v --dry-run

Upgrade specified version number

$ standard-version -r 0.1.0 --dry-run

Upgrade Version Number

$ standard-version -r major --preMajor true --dry-run
$ standard-version -r minor --preMajor true --dry-run
$ standard-version -r patch --preMajor true --dry-run

Pre-release version number

$ standard-version -p Alpha --preMajor true --dry-run
$ standard-version -p Beta --dry-run
$ standard-version -p RC --dry-run

First release: 1.0.0-Stable

$standard-version-f --release CommitMessageFormat stable--dry-run

Upgrade Version Number

$ standard-version -r major --dry-run
$ standard-version -r minor --dry-run
$ standard-version -r patch --dry-run

Revision/Enhancement

$ standard-version -p SR --dry-run

Emergency Repair

$ standard-version -p Hotfix --dry-run

Custom header information

$ standard-version -r patch --changelogHeader # ERM(ER Diagram Modeling Tool)

Help

$ standard-version -h
Usage: cli.js [options]

Preset Configuration:
  --header                      A string to be used as the main header section of the CHANGELOG.
                                                                  [string] [default: "# Changelog"]

  --types                       An array of `type` objects representing the explicitly supported
                                commit message types, and whether they should show up in
                                generated `CHANGELOG`s.
  [array] [default: [{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"
  type":"chore","hidden":true},{"type":"docs","hidden":true},{"type":"style","hidden":true},{"typ
       e":"refactor","hidden":true},{"type":"perf","hidden":true},{"type":"test","hidden":true}]]
  --preMajor                    Boolean indicating whether or not the action being run
                                (generating CHANGELOG, recommendedBump, etc.) is being performed
                                for a pre-major release (<1.0.0).
                                This config setting will generally be set by tooling and not a
                                user.                                  [boolean] [default: false]
  --commitUrlFormat             A URL representing a specific commit at a hash.
                          [string] [default: "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}"]
  --compareUrlFormat            A URL representing the comparison between two git SHAs.
                                                                               [string] [default:
                    "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}"]
  --issueUrlFormat              A URL representing the issue format (allowing a different URL
                                format to be swapped in for Gitlab, Bitbucket, etc).
                            [string] [default: "{{host}}/{{owner}}/{{repository}}/issues/{{id}}"]
  --userUrlFormat               A URL representing the a user's profile URL on GitHub, Gitlab,
                                etc. This URL is used for substituting @bcoe with
                                https://github.com/bcoe in commit messages.
                                                          [string] [default: "{{host}}/{{user}}"]
  --releaseCommitMessageFormat  A string to be used to format the auto-generated release commit
                                message.     [string] [default: "chore(release): {{currentTag}}"]

Options:
  --help, -h           Show help                                                        [boolean]
  --version, -v        Show version number                                              [boolean]
  --release-as, -r     Specify the release type manually (like npm version <major|minor|patch>)
                                                                                         [string]
  --prerelease, -p     make a pre-release with optional option value to specify a tag id [string]
  --infile, -i         Read the CHANGELOG from this file                [default: "CHANGELOG.md"]
  --message, -m        [DEPRECATED] Commit message, replaces %s with new version.
                       This option will be removed in the next major version, please use
                       --releaseCommitMessageFormat.                                     [string]
  --first-release, -f  Is this the first release?                      [boolean] [default: false]
  --sign, -s           Should the git commit and tag be signed?        [boolean] [default: false]
  --no-verify, -n      Bypass pre-commit or commit-msg git hooks during the commit phase
                                                                       [boolean] [default: false]
  --commit-all, -a     Commit all staged changes, not just files affected by standard-version
                                                                       [boolean] [default: false]
  --silent             Don't print logs and errors                     [boolean] [default: false]
  --tag-prefix, -t     Set a custom prefix for the git tag to be created  [string] [default: "v"]
  --scripts            Provide scripts to execute for lifecycle events (prebump, precommit,
                       etc.,)                                                       [default: {}]
  --skip               Map of steps in the release process that should be skipped   [default: {}]
  --dry-run            See the commands that running standard-version would run
                                                                       [boolean] [default: false]
  --git-tag-fallback   fallback to git tags for version, if no meta-information file is found
                       (e.g., package.json)                             [boolean] [default: true]
  --path               Only populate commits made under this path                        [string]
  --changelogHeader    Use a custom header when generating and updating changelog.       [string]
  --preset             Commit message guideline preset  [string] [default: "conventionalcommits"]~~~~

Posted by p2003morris on Thu, 07 Nov 2019 07:24:22 -0800