Skip to content

Commit 53685fc

Browse files
committed
Rename optional to ignoreMissingScript in command-line schema
1 parent f4c5756 commit 53685fc

6 files changed

Lines changed: 12 additions & 12 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
@@ -51,7 +51,7 @@ export class CustomCommandFactory {
5151
documentation: command.documentation || command.summary
5252
},
5353
command.parallelized,
54-
command.optional
54+
command.ignoreMissingScript
5555
));
5656
});
5757

‎apps/rush-lib/src/cli/actions/CustomRushAction.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class CustomRushAction extends BaseRushAction {
4444
constructor(private _parser: RushCommandLineParser,
4545
options: ICommandLineActionOptions,
4646
private _parallelized: boolean = false,
47-
private _optional: boolean = false
47+
private _ignoreMissingScript: boolean = false
4848
) {
4949
super(options);
5050
}
@@ -105,7 +105,7 @@ export class CustomRushAction extends BaseRushAction {
105105
parallelism,
106106
isIncrementalBuildAllowed: this.options.actionVerb === 'build',
107107
changedProjectsOnly,
108-
optional: this._optional
108+
ignoreMissingScript: this._ignoreMissingScript
109109
}
110110
);
111111

‎apps/rush-lib/src/cli/logic/TaskSelector.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface ITaskSelectorConstructor {
1818
parallelism: string;
1919
isIncrementalBuildAllowed: boolean;
2020
changedProjectsOnly: boolean;
21-
optional: boolean;
21+
ignoreMissingScript: boolean;
2222
}
2323

2424
/**
@@ -169,7 +169,7 @@ export class TaskSelector {
169169
this._options.commandToRun,
170170
this._options.customFlags,
171171
this._options.isIncrementalBuildAllowed,
172-
this._options.optional
172+
this._options.ignoreMissingScript
173173
);
174174

175175
if (!this._taskRunner.hasTask(projectTask.name)) {

‎apps/rush-lib/src/cli/taskRunner/ProjectTask.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class ProjectTask implements ITaskDefinition {
4141
private _commandToRun: string,
4242
private _customFlags: string[],
4343
public isIncrementalBuildAllowed: boolean,
44-
private _optional: boolean
44+
private _ignoreMissingScript: boolean
4545
) {}
4646

4747
public execute(writer: ITaskWriter): Promise<TaskStatus> {
@@ -173,7 +173,7 @@ export default class ProjectTask implements ITaskDefinition {
173173
} else {
174174
script = this._getScriptCommand(this._commandToRun);
175175

176-
if (script === undefined && !this._optional) {
176+
if (script === undefined && !this._ignoreMissingScript) {
177177
// tslint:disable-next-line:max-line-length
178178
throw new Error(`The project [${this._rushProject.packageName}] does not define a '${this._commandToRun}' command in the 'scripts' section of its package.json`);
179179
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface ICustomCommand {
1616
summary: string;
1717
documentation: string | undefined;
1818
parallelized: boolean;
19-
optional: boolean;
19+
ignoreMissingScript: boolean;
2020
}
2121

2222
export interface ICustomEnumValue {

‎apps/rush-lib/src/schemas/command-line.schema.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"title": "Custom Command",
2121
"type": "object",
2222
"additionalProperties": false,
23-
"required": [ "name", "summary", "documentation", "parallelized", "optional" ],
23+
"required": [ "name", "summary", "documentation", "parallelized" ],
2424
"properties": {
2525
"name": {
2626
"title": "Custom Command Name",
@@ -42,9 +42,9 @@
4242
"description": "Describes whether or not this command can be run in parallel (with multiple instances running on several projects simultaneously). Defaults to 'true'.",
4343
"type": "boolean"
4444
},
45-
"optional": {
46-
"title": "Is optional and only applies to projects with corresponding npm script",
47-
"description": "Indicates whether the command runs on every project or just projects that have the corresponding npm script.",
45+
"ignoreMissingScript": {
46+
"title": "Ignore missing script",
47+
"description": "Normally Rush requires that each project's package.json has a \"script\" entry matching the custom command name. To disable this check, set \"ignoreMissingScript\" to true.",
4848
"type": "boolean"
4949
}
5050
}

0 commit comments

Comments
 (0)