Nx plugin to automate semantic versioning and CHANGELOG generation.
Nx plugin to automate semantic versioning and CHANGELOG generation.
Nx plugin for versioning using SemVer and CHANGELOG generation powered by Conventional Commits.
npm install -D @jscutlery/semver
nx g @jscutlery/semver:installThis package allows you to manage your Nx workspace using one of two modes: Synced or Independent.
Allow multiple projects to be versioned independently. This way you release only what you want and consumers don't get updates they don't need. This allows small, rapid and incremental adoption of your packages.
Allow multiple projects to be versioned in a synced/locked mode. Use this if you want to automatically tie all package versions together. This mode is useful when you are working with only one product. One issue with this approach is that a major change in any project will result in all projects having a new major version.
Release project independently by running:
nx run my-project:version [...options]You can leverage the affected command to only version changed packages:
nx affected --target version [...options]Release workspace by running:
nx run workspace:version [...options]--verifyNpmAuth).git tag.package.json version based on the commits.package.json file and updated CHANGELOG.| name | type | default | description |
|---|---|---|---|
--dryRun |
boolean |
false |
run with dry mode |
--noVerify |
boolean |
false |
skip git hooks |
--enforceAtomicPush |
boolean |
false |
enforce an atomic push without retrying a non atomic one in case of failure |
--push |
boolean |
false |
push the release to the remote repository |
--verifyNpmAuth |
boolean |
false |
verify npm registry authentication before versioning (details) |
--syncVersions |
boolean |
false |
lock/sync versions between projects |
--skipRootChangelog |
boolean |
false |
skip generating root changelog |
--skipProjectChangelog |
boolean |
false |
skip generating project changelog |
--origin |
string |
'origin' |
push against git remote repository |
--baseBranch |
string |
'main' |
push against git base branch |
--changelogHeader |
string |
undefined |
custom Markdown header for changelogs |
--releaseAs |
string |
undefined |
specify the level of change (details) |
--preid |
string |
undefined |
specify the prerelease identifier (eg: alpha, beta) (details) |
--tagPrefix |
string |
undefined |
specify the tag prefix (details) |
--tagSign |
boolean |
false |
Make a GPG-signed git tag, using git --sign |
--postTargets |
string[] |
[] |
specify the list of target to execute post-release (details) |
--trackDeps |
boolean |
false |
bump dependent packages (bump A if A depends on B) (details) |
--trackDepsWithReleaseAs |
boolean |
false |
enables --trackDeps when using it with --releaseAs |
--allowEmptyRelease |
boolean |
false |
force a patch increment even if library source didn't change |
--skipCommitTypes |
string[] |
[] |
treat commits with specified types as non invoking version bump (details) |
--skipCommit |
boolean |
false |
skips generating a new commit, leaves all changes in index, tag would be put on last commit (details) |
--skipStage |
boolean |
false |
skips add to git stage, useful when you want to run nx cmd in parallel (details) |
--commitMessageFormat |
string |
undefined |
format the auto-generated message commit (details) |
--preset |
string | object |
'conventionalcommits' |
customize Conventional Changelog options (details) |
--commitParserOptions |
object |
undefined |
customize the commit parserConfig (details) |
You can customize the default configuration using the definition file:
{
"executor": "@jscutlery/semver:version",
"options": {
"baseBranch": "master",
"preset": "atom",
"tagPrefix": "{projectName}@"
}
}This tool comes with a list of pre-configured presets:
conventionalcommits (default)
Complete list of presets
The preset is highly configurable, following the conventional-changelog-config-spec. As an example, suppose you're using GitLab, rather than GitHub, you might modify the following variables:
{
"executor": "@jscutlery/semver:version",
"options": {
"preset": {
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
"compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
"issueUrlFormat": "{{host}}/{{owner}}/{{repository}}/issues/{{id}}",
"types": [
{ "type": "feat", "section": "✨ Features" },
{ "type": "fix", "section": " Bug Fixes" },
{ "type": "chore", "hidden": true }
]
}
}
}[!NOTE] When customizing a preset it will implicitly use the conventionalcommits preset and override the default settings with the given configuration.
It is possible to customize any preset by passing its name.
{
"executor": "@jscutlery/semver:version",
"options": {
"preset": {
"name": "angular",
"types": [
{ "type": "feat", "section": "✨ Features" },
{ "type": "fix", "section": " Bug Fixes" }No open issues yet, or sync has not completed.