fix(release): ensure given preid modifies conventional commits specifier (#26524)

This commit is contained in:
James Henry 2024-06-12 22:23:49 +04:00 committed by GitHub
parent 5d56e21163
commit 2ba4cf23f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View File

@ -165,7 +165,7 @@ Show help
Type: `string` Type: `string`
The optional prerelease identifier to apply to the version, in the case that the specifier argument has been set to `prerelease`. 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
##### specifier ##### specifier

View File

@ -165,7 +165,7 @@ Show help
Type: `string` Type: `string`
The optional prerelease identifier to apply to the version, in the case that the specifier argument has been set to `prerelease`. 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
##### specifier ##### specifier

View File

@ -406,8 +406,13 @@ To fix this you will either need to add a package.json file at that location, or
`📄 Resolved the specifier as "${specifier}" since the current version is a prerelease.` `📄 Resolved the specifier as "${specifier}" since the current version is a prerelease.`
); );
} else { } else {
let extraText = '';
if (options.preid && !specifier.startsWith('pre')) {
specifier = `pre${specifier}`;
extraText = `, combined with your given preid "${options.preid}"`;
}
log( log(
`📄 Resolved the specifier as "${specifier}" using git history and the conventional commits standard.` `📄 Resolved the specifier as "${specifier}" using git history and the conventional commits standard${extraText}.`
); );
} }
break; break;

View File

@ -203,7 +203,7 @@ const versionCommand: CommandModule<NxReleaseArgs, VersionOptions> = {
.option('preid', { .option('preid', {
type: 'string', type: 'string',
describe: describe:
'The optional prerelease identifier to apply to the version, in the case that the specifier argument has been set to `prerelease`.', '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: '', default: '',
}) })
.option('stage-changes', { .option('stage-changes', {