Skip to content

Commit 6707a1e

Browse files
committed
Address comments
1 parent 32613c9 commit 6707a1e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export abstract class BaseInstallAction extends BaseRushAction {
6464
this._maxInstallAttempts = this.defineIntegerParameter({
6565
parameterLongName: '--max-install-attempts',
6666
argumentName: 'NUMBER',
67-
description: `Overrides the default maximum number of install attempts.`
68-
+ ` The default value is ${RushConstants.defaultMaxInstallAttempts}.`
67+
description: `Overrides the default maximum number of install attempts.`,
68+
defaultValue: RushConstants.defaultMaxInstallAttempts
6969
});
7070
this._variant = this.defineStringParameter(Variants.VARIANT_PARAMETER);
7171
}
@@ -104,7 +104,9 @@ export abstract class BaseInstallAction extends BaseRushAction {
104104
}
105105
}
106106

107-
if (this._maxInstallAttempts.value && this._maxInstallAttempts.value < 1) {
107+
// Because the 'defautltValue' option on the _maxInstallAttempts parameter is set,
108+
// it is safe to assume that the value is not null
109+
if (this._maxInstallAttempts.value! < 1) {
108110
throw new Error(`The value of "${this._maxInstallAttempts.longName}" must be positive.`);
109111
}
110112

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import { BaseInstallAction } from './BaseInstallAction';
55
import { IInstallManagerOptions } from '../../logic/InstallManager';
66
import { RushCommandLineParser } from '../RushCommandLineParser';
7-
import { RushConstants } from '../../logic/RushConstants';
87

98
export class InstallAction extends BaseInstallAction {
109
public constructor(parser: RushCommandLineParser) {
@@ -36,9 +35,9 @@ export class InstallAction extends BaseInstallAction {
3635
networkConcurrency: this._networkConcurrencyParameter.value,
3736
collectLogFile: this._debugPackageManagerParameter.value!,
3837
variant: this._variant.value,
39-
maxInstallAttempts: this._maxInstallAttempts.value !== undefined
40-
? this._maxInstallAttempts.value
41-
: RushConstants.defaultMaxInstallAttempts
38+
// Because the 'defautltValue' option on the _maxInstallAttempts parameter is set,
39+
// it is safe to assume that the value is not null
40+
maxInstallAttempts: this._maxInstallAttempts.value!
4241
};
4342
}
4443
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { CommandLineFlagParameter } from '@microsoft/ts-command-line';
66
import { BaseInstallAction } from './BaseInstallAction';
77
import { IInstallManagerOptions } from '../../logic/InstallManager';
88
import { RushCommandLineParser } from '../RushCommandLineParser';
9-
import { RushConstants } from '../../logic/RushConstants';
109

1110
export class UpdateAction extends BaseInstallAction {
1211
private _fullParameter: CommandLineFlagParameter;
@@ -64,9 +63,9 @@ export class UpdateAction extends BaseInstallAction {
6463
networkConcurrency: this._networkConcurrencyParameter.value,
6564
collectLogFile: this._debugPackageManagerParameter.value!,
6665
variant: this._variant.value,
67-
maxInstallAttempts: this._maxInstallAttempts.value !== undefined
68-
? this._maxInstallAttempts.value
69-
: RushConstants.defaultMaxInstallAttempts
66+
// Because the 'defautltValue' option on the _maxInstallAttempts parameter is set,
67+
// it is safe to assume that the value is not null
68+
maxInstallAttempts: this._maxInstallAttempts.value!
7069
};
7170
}
7271
}

apps/rush-lib/src/logic/InstallManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ export class InstallManager {
10861086
if (environmentVariables[envVar].override &&
10871087
environmentVariables[envVar].override === true) {
10881088
setEnvironmentVariable = true;
1089-
console.log(colors.yellow(`WARNING: Overriding the environment variable with the value set in rush.json.`));
1089+
console.log(`Overriding the environment variable with the value set in rush.json.`);
10901090
}
10911091
else {
10921092
console.log(colors.yellow(`WARNING: Not overriding the value of the environment variable.`));

0 commit comments

Comments
 (0)