From d8345147ed181c27dced0046427ab931503bc28f Mon Sep 17 00:00:00 2001 From: Alejandro Forero <56932461+focusaway@users.noreply.github.com> Date: Mon, 17 Feb 2025 06:17:15 -0500 Subject: [PATCH] fix(release): allow preid option in release command (#29264) --- docs/generated/cli/release.md | 1 + docs/generated/packages/nx/documents/release.md | 1 + packages/nx/src/command-line/release/command-object.ts | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/docs/generated/cli/release.md b/docs/generated/cli/release.md index ac10af0b79..15292c91ab 100644 --- a/docs/generated/cli/release.md +++ b/docs/generated/cli/release.md @@ -43,6 +43,7 @@ nx release [specifier] | ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--first-release` | boolean | Indicates that this is the first release for the selected release group. If the current version cannot be determined as usual, the version on disk will be used as a fallback. This is useful when using git or the registry to determine the current version of packages, since those sources are only available after the first release. Also indicates that changelog generation should not assume a previous git tag exists and that publishing should not check for the existence of the package before running. | | `--help` | boolean | Show help. | +| `--preid` | string | The optional prerelease identifier to apply to the version. This will only be applied in the case that the specifier argument has been set to `prerelease` OR when conventional commits are enabled, in which case it will modify the resolved specifier from conventional commits to be its prerelease equivalent. E.g. minor -> preminor. (Default: ``) | | `--skip-publish` | boolean | Skip publishing by automatically answering no to the confirmation prompt for publishing. | | `--specifier` | string | Exact version or semver keyword to apply to the selected release group. | | `--version` | boolean | Show version number. | diff --git a/docs/generated/packages/nx/documents/release.md b/docs/generated/packages/nx/documents/release.md index ac10af0b79..15292c91ab 100644 --- a/docs/generated/packages/nx/documents/release.md +++ b/docs/generated/packages/nx/documents/release.md @@ -43,6 +43,7 @@ nx release [specifier] | ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--first-release` | boolean | Indicates that this is the first release for the selected release group. If the current version cannot be determined as usual, the version on disk will be used as a fallback. This is useful when using git or the registry to determine the current version of packages, since those sources are only available after the first release. Also indicates that changelog generation should not assume a previous git tag exists and that publishing should not check for the existence of the package before running. | | `--help` | boolean | Show help. | +| `--preid` | string | The optional prerelease identifier to apply to the version. This will only be applied in the case that the specifier argument has been set to `prerelease` OR when conventional commits are enabled, in which case it will modify the resolved specifier from conventional commits to be its prerelease equivalent. E.g. minor -> preminor. (Default: ``) | | `--skip-publish` | boolean | Skip publishing by automatically answering no to the confirmation prompt for publishing. | | `--specifier` | string | Exact version or semver keyword to apply to the selected release group. | | `--version` | boolean | Show version number. | diff --git a/packages/nx/src/command-line/release/command-object.ts b/packages/nx/src/command-line/release/command-object.ts index 57f4e40161..c8eb6f4dad 100644 --- a/packages/nx/src/command-line/release/command-object.ts +++ b/packages/nx/src/command-line/release/command-object.ts @@ -86,6 +86,7 @@ export type ReleaseOptions = NxReleaseArgs & FirstReleaseArgs & { specifier?: string; yes?: boolean; + preid?: VersionOptions['preid']; skipPublish?: boolean; }; @@ -186,6 +187,12 @@ const releaseCommand: CommandModule = { describe: 'Exact version or semver keyword to apply to the selected release group.', }) + .option('preid', { + type: 'string', + describe: + 'The optional prerelease identifier to apply to the version. This will only be applied in the case that the specifier argument has been set to `prerelease` OR when conventional commits are enabled, in which case it will modify the resolved specifier from conventional commits to be its prerelease equivalent. E.g. minor -> preminor.', + default: '', + }) .option('yes', { type: 'boolean', alias: 'y',