Skip to content

Commit 639b4e9

Browse files
committed
PR feedback
1 parent 1152d8f commit 639b4e9

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class CustomCommandFactory {
2121
parser.rushConfiguration.commonRushConfigFolder, RushConstants.commandLineFilename
2222
);
2323
const commandLineConfiguration: CommandLineConfiguration
24-
= CommandLineConfiguration.tryLoadFromFile(commandLineConfigFile);
24+
= CommandLineConfiguration.loadFromFileOrDefault(commandLineConfigFile);
2525

2626
const documentationForBuild: string = 'The Rush build command assumes that the package.json file for each'
2727
+ ' project contains a "scripts" entry for "npm run build". It invokes'

apps/rush-lib/src/data/CommandLineConfiguration.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ export class CommandLineConfiguration {
2828
public readonly commands: CommandJson[] = [];
2929
public readonly parameters: ParameterJson[] = [];
3030

31-
public static tryLoadFromFile(jsonFilename: string): CommandLineConfiguration {
31+
/**
32+
* Loads the configuration from the specified file. If the file does not exist,
33+
* then an empty default instance is returned. If the file contains errors, then
34+
* an exception is thrown.
35+
*/
36+
public static loadFromFileOrDefault(jsonFilename: string): CommandLineConfiguration {
3237
let commandLineJson: ICommandLineJson | undefined = undefined;
3338
if (fs.existsSync(jsonFilename)) {
3439
commandLineJson = JsonFile.loadAndValidate(jsonFilename, CommandLineConfiguration._jsonSchema);

0 commit comments

Comments
 (0)