Customize Conventional Commit Types

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)
No changes detected

If Nx Release does not find any relevant commits since the last release, it will skip releasing a new version. This works with independent releases as well, allowing for only some projects to be released while others are skipped.

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

To disable a commit type, set it to false.

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 // disable the docs type for versioning and in the changelog 6 "docs": false, 7 ... 8 } 9 } 10 } 11} 12

If you just want to disable a commit type for versioning, but still want it to appear in the changelog, set semverBump to none.

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 // disable the docs type for versioning, but still include it in the changelog 6 "docs": { 7 "semverBump": "none", 8 ... 9 }, 10 ... 11 } 12 } 13 } 14} 15

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:

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 "docs": { 6 "semverBump": "patch", 7 ... 8 }, 9 } 10 } 11 } 12} 13

Renaming the Changelog Section for a Commit Type

To rename the changelog section for a commit type, set the title property.

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 ... 6 "docs": { 7 ... 8 "changelog": { 9 "title": "Documentation Changes" 10 } 11 }, 12 ... 13 } 14 } 15 } 16} 17

Hiding a Commit Type from the Changelog

To hide a commit type from the changelog, set changelog to false.

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 ... 6 "chore": { 7 "changelog": false 8 }, 9 ... 10 } 11 } 12 } 13} 14

Alternatively, you can set hidden to true to achieve the same result.

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 ... 6 "chore": { 7 "changelog": { 8 "hidden": true 9 } 10 }, 11 ... 12 } 13 } 14 } 15} 16

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.

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 "awesome": {} 6 } 7 } 8 } 9} 10

Including Invalid Commits in the Changelog

Nx only includes commits in the changelog that match either the default conventional commit types or types you've added to your configuration.

You can configure Nx to include non-matching commits by adding the special __INVALID__ type.

This can also 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.

Alternative to Conventional Commits

If you don't plan on using Conventional Commits, file based versioning via Version Plans is the recommended alternative for managing releases. See our docs on File Based Versioning for more information.

nx.json
1{ 2 "release": { 3 "conventionalCommits": { 4 "types": { 5 "__INVALID__": { 6 "semverBump": "paths", // Note: the default is "none" 7 "changelog": { 8 "title": "Uncategorized changes" 9 } 10 } 11 } 12 } 13 } 14} 15