Skip to content

Commit

Permalink
fix(release): ensure given preid modifies conventional commits specif…
Browse files Browse the repository at this point in the history
…ier (#26524)
  • Loading branch information
JamesHenry authored Jun 12, 2024
1 parent 5d56e21 commit 2ba4cf2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/generated/cli/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Show help

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

Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/nx/documents/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Show help

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
);
} else {
let extraText = '';
if (options.preid && !specifier.startsWith('pre')) {
specifier = `pre${specifier}`;
extraText = `, combined with your given preid "${options.preid}"`;
}
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;
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/command-line/release/command-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const versionCommand: CommandModule<NxReleaseArgs, VersionOptions> = {
.option('preid', {
type: 'string',
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: '',
})
.option('stage-changes', {
Expand Down

0 comments on commit 2ba4cf2

Please sign in to comment.