Nx release allows you to leverage the conventional commits standard to automatically determine the next version increment.
By default, this results in:
feat(...)
triggering a minor version bump (1.?.0
)fix(...)
triggering a patch version bump (1.?.x
)BREAKING CHANGE
in the footer of the commit message or with an exclamation mark after the commit type (fix(...)!
) triggers a major version bump (?.0.0
)
However, you can customize how Nx interprets these conventional commits, for both versioning and changelog generation.
Disable a Commit Type for Versioning and Changelog Generation
Section titled “Disable a Commit Type for Versioning and Changelog Generation”To disable a commit type, set it to false
.
{ "release": { "conventionalCommits": { "types": { // disable the docs type for versioning and in the changelog "docs": false, ... } } }}
If you just want to disable a commit type for versioning, but still want it to appear in the changelog, set semverBump
to none
.
{ "release": { "conventionalCommits": { "types": { // disable the docs type for versioning, but still include it in the changelog "docs": { "semverBump": "none", ... }, ... } } }}
Changing the Type of Semver Version Bump
Section titled “Changing the Type of Semver Version Bump”Assume you'd like docs(...)
commit types to cause a patch
version bump. You can define that as follows:
{ "release": { "conventionalCommits": { "types": { "docs": { "semverBump": "patch", ... }, } } }}
Renaming the Changelog Section for a Commit Type
Section titled “Renaming the Changelog Section for a Commit Type”To rename the changelog section for a commit type, set the title
property.
{ "release": { "conventionalCommits": { "types": { ... "docs": { ... "changelog": { "title": "Documentation Changes" } }, ... } } }}
Hiding a Commit Type from the Changelog
Section titled “Hiding a Commit Type from the Changelog”To hide a commit type from the changelog, set changelog
to false
.
{ "release": { "conventionalCommits": { "types": { ... "chore": { "changelog": false }, ... } } }}
Alternatively, you can set hidden
to true
to achieve the same result.
{ "release": { "conventionalCommits": { "types": { ... "chore": { "changelog": { "hidden": true } }, ... } } }}
Defining non-standard Commit Types
Section titled “Defining non-standard Commit Types”If you want to use custom, non-standard conventional commit types, you can define them in the types
object. If you don't specify a semverBump
, Nx will default to patch
.
{ "release": { "conventionalCommits": { "types": { "awesome": {} } } }}
Including Invalid Commits in the Changelog
Section titled “Including Invalid Commits in the Changelog”Nx Release ignores all commits that do not conform to the Conventional Commits standard by default. A special __INVALID__
type is available in situations where you want to process invalid messages.
This can be useful in cases where you have not managed to be consistent with your use of the Conventional Commits standard (e.g. when applying it retroactively to an existing codebase) but still want a changelog to be generated with the contents of each commit message and/or for invalid commits to still affect project versioning.
{ "release": { "conventionalCommits": { "types": { "__INVALID__": { "semverBump": "patch", // Note: the default is "none" "changelog": { "title": "Uncategorized changes" } } } } }}