Skip to content

Commit b4faa9c

Browse files
committed
Add support for "--bump-type none"
1 parent 554d2c7 commit b4faa9c

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

apps/rush-lib/src/cli/actions/ChangeAction.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class ChangeAction extends BaseRushAction {
140140

141141
this._bulkChangeBumpTypeParameter = this.defineChoiceParameter({
142142
parameterLongName: BULK_BUMP_TYPE_LONG_NAME,
143-
alternatives: Object.keys(this._getBumpOptions()),
143+
alternatives: [...Object.keys(this._getBumpOptions()), ChangeType[ChangeType.none]],
144144
description: `The bump type to apply to all changed projects if the ${BULK_LONG_NAME} flag is provided.`
145145
});
146146
}
@@ -150,9 +150,12 @@ export class ChangeAction extends BaseRushAction {
150150
this._projectHostMap = this._generateHostMap();
151151

152152
if (this._verifyParameter.value) {
153-
const errors: string[] = (
154-
[this._bulkChangeParameter, this._bulkChangeMessageParameter, this._bulkChangeBumpTypeParameter]
155-
).map((parameter) => {
153+
const errors: string[] = ([
154+
this._bulkChangeParameter,
155+
this._bulkChangeMessageParameter,
156+
this._bulkChangeBumpTypeParameter,
157+
this._overwriteFlagParemter
158+
]).map((parameter) => {
156159
return parameter.value
157160
? (
158161
`The {${this._bulkChangeParameter.longName} parameter cannot be provided with the ` +
@@ -181,10 +184,18 @@ export class ChangeAction extends BaseRushAction {
181184
let changeFileDataPromise: Promise<Map<string, IChangeFile>>;
182185
let allowOverwriteHandler: (filePath: string) => Promise<boolean>;
183186
if (this._bulkChangeParameter.value) {
184-
if (!this._bulkChangeBumpTypeParameter.value || !this._bulkChangeMessageParameter.value) {
187+
if (
188+
!this._bulkChangeBumpTypeParameter.value ||
189+
(
190+
!this._bulkChangeMessageParameter.value &&
191+
this._bulkChangeBumpTypeParameter.value !== ChangeType[ChangeType.none]
192+
)
193+
) {
185194
throw new Error(
186195
`The ${this._bulkChangeBumpTypeParameter.longName} and ${this._bulkChangeMessageParameter.longName} ` +
187-
`parameters must provided if the ${this._bulkChangeParameter.longName} flag is provided.`
196+
`parameters must provided if the ${this._bulkChangeParameter.longName} flag is provided. If the ` +
197+
`${this._bulkChangeBumpTypeParameter.longName}'s value is set to "${ChangeType[ChangeType.none]}", the ` +
198+
`${this._bulkChangeMessageParameter.longName} parameter may be omitted.`
188199
);
189200
}
190201

@@ -198,7 +209,7 @@ export class ChangeAction extends BaseRushAction {
198209

199210
const errors: string[] = [];
200211

201-
const comment: string = this._bulkChangeMessageParameter.value;
212+
const comment: string = this._bulkChangeMessageParameter.value || '';
202213
const changeType: string = this._bulkChangeBumpTypeParameter.value;
203214
const changeFileData: Map<string, IChangeFile> = new Map<string, IChangeFile>();
204215
for (const packageName of sortedProjectList) {

apps/rush-lib/src/cli/test/__snapshots__/CommandLineHelp.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Optional arguments:
143143
exports[`CommandLineHelp prints the help for each action: change 1`] = `
144144
"usage: rush change [-h] [-v] [--no-fetch] [-b BRANCH] [--overwrite]
145145
[--email EMAIL] [--bulk] [--message MESSAGE]
146-
[--bump-type {major,minor,patch}]
146+
[--bump-type {major,minor,patch,none}]
147147
148148
149149
Asks a series of questions and then generates a <branchname>-<timestamp>.json
@@ -186,7 +186,7 @@ Optional arguments:
186186
specified if the --bulk parameter is specified
187187
--message MESSAGE The message to apply to all changed projects if the
188188
--bulk flag is provided.
189-
--bump-type {major,minor,patch}
189+
--bump-type {major,minor,patch,none}
190190
The bump type to apply to all changed projects if the
191191
--bulk flag is provided.
192192
"

0 commit comments

Comments
 (0)