-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: describe conventional commits (#789)
Co-authored-by: adeeri <[email protected]>
- Loading branch information
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Conventional commits | ||
|
||
[Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) are human and machine readable commit messages. We use them to automatically generate changelog items and [semantic version (SemVer)](https://semver.org/) bumps on release using [NX](https://nx.dev). Here is an example of a commit message describing a bug fix in a backup script. Releasing this change would bump the project's patch version number: | ||
|
||
``` | ||
fix(backup-script): report error if no space left on device | ||
``` | ||
|
||
On release of a project, NX collects all commit messages from git for the project's directory (e.g. `build/wdqs`) since last release (e.g. `[email protected]`). For this to work well we need to follow a certain procedure in our Pull requests: | ||
|
||
- Use conventional commit syntax for the PR title, then squash merge the PR, so that the squashed commit will contain the conventional commit message from the PR title on the target branch. The PR body will become the commit message body. | ||
- Or: Merge with merge commit so that all commits from the PR are retained on the target branch. All commits in the PR should follow conventional commit syntax then. | ||
|
||
## Supported types | ||
|
||
NX supports [a number of](https://github.com/nrwl/nx/blob/db10812da789cd48d3a722628a00feda9d0e3810/packages/nx/src/command-line/release/config/conventional-commits.ts) conventional commit types. We use the following for changelog generation as configured in our [nx.json](https://github.com/wmde/wikibase-release-pipeline/blob/main/nx.json): | ||
|
||
| Type | SemVer Bump | Changelog Title | | ||
| -------- | ----------- | ---------------- | | ||
| build | patch | π¦ Build | | ||
| chore | patch | π‘ Chore | | ||
| ci | patch | π€ CI | | ||
| docs | patch | π Documentation | | ||
| feat | minor | π Features | | ||
| fix | patch | π©Ή Fixes | | ||
| perf | patch | π₯ Performance | | ||
| refactor | patch | π Refactors | | ||
| style | patch | π¨ Styles | | ||
| test | patch | β Tests | | ||
|
||
## Examples | ||
|
||
### Feature | ||
|
||
A new feature implementation bumping the minor version: | ||
|
||
``` | ||
feat: added support for cats | ||
``` | ||
|
||
Will generate the following changelog entry: | ||
|
||
#### π Features | ||
|
||
- added support for cats | ||
|
||
### Documentation update | ||
|
||
Some update to the docs bumping a minor version: | ||
|
||
``` | ||
docs: describe how to work around sleeping cats | ||
``` | ||
|
||
Will generate the following changelog entry: | ||
|
||
#### π Documentation | ||
|
||
- describe how to work around sleeping cats | ||
|
||
### Breaking change | ||
|
||
All types can be breaking changes. Here is an example for a breaking refactor, bumping a major version. | ||
|
||
``` | ||
refactor!: remove support for sabre-toothed tiger | ||
``` | ||
|
||
Will generate the following changelog entry: | ||
|
||
#### π Refactors | ||
|
||
- remove support for sabre-toothed tiger | ||
|
||
### Performance change for a certain component | ||
|
||
Noting that a change is specific to a component or subsystem in a project. | ||
|
||
``` | ||
pref(food-dispenser): improved speed | ||
``` | ||
|
||
Will generate the following changelog entry: | ||
|
||
#### π₯ Performance | ||
|
||
- food-dispenser: improved speed |