semantic versioning, based on conventional commits uses a well defined scheme for versioning software.
A semantic version has the form of <major>.<minor>.<patch>, e.g. 1.4.3, whereas:
- a major version indicates incompatible API / application changes - in an application project often tied to production releases or to indicate different stages in development.
- a minor indicates added functionality in a backwards-compatible manner
- a patch version indicates the addition of backwards-compatible bug fixes.
Tooling support is provided by standard-version, that aids the generation of standard versions, including related artifacts like changelog,
npm install standard-version --save-dev
# or
yarn add standard-version --dev// package.json
{
"scripts": {
"release": "standard-version"
}
}Running yarn release will automatically:
- update the
versionfield in package.json - create a commit (including commit-message following the standard defined commit messages)
- create a tag with version
- push commit and tag to
remote
For version detection semantic-version will consider the following commit types:
fixwill result in apatchversion bumpfeatwill result in aminorversion bump- adding
BREAKING CHANGE: <description of breaking change>will result in amajorversion bump
If necessary (e.g., for applications that usually do not create breaking changes) it is also possible to use --release-as <major|minor|patch> to force a major bump
- ADR-0004 - Use standard-version for versioning