diff --git a/common/changes/@microsoft/rush/add-defaultCommand_2023-07-13-11-07.json b/common/changes/@microsoft/rush/add-defaultCommand_2023-07-13-11-07.json new file mode 100644 index 0000000000..7cf87f5a7b --- /dev/null +++ b/common/changes/@microsoft/rush/add-defaultCommand_2023-07-13-11-07.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "add defaultCommand", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/common/reviews/api/rush-lib.api.md b/common/reviews/api/rush-lib.api.md index 948ad08cf4..48326720f8 100644 --- a/common/reviews/api/rush-lib.api.md +++ b/common/reviews/api/rush-lib.api.md @@ -461,6 +461,7 @@ export interface IPackageManagerOptionsJsonBase { export interface IPhase { allowWarningsOnSuccess: boolean; associatedParameters: Set; + defaultCommand?: string; dependencies: { self: Set; upstream: Set; diff --git a/libraries/rush-lib/src/api/CommandLineConfiguration.ts b/libraries/rush-lib/src/api/CommandLineConfiguration.ts index c49de0384d..7df7abe7d6 100644 --- a/libraries/rush-lib/src/api/CommandLineConfiguration.ts +++ b/libraries/rush-lib/src/api/CommandLineConfiguration.ts @@ -87,6 +87,16 @@ export interface IPhase { * values will be appended to the end of this string. */ shellCommand?: string; + + /** + * (Optional) If the `defaultCommand` field is set for a bulk command, when Rush can't find the package.json `"scripts"` entry + * matching Rush command/phase name, it will fall back to this command. + * + * This string is the path to a script that will be invoked using the OS shell. The working directory will be + * the folder that contains rush.json. If custom parameters are associated with this command, their + * values will be appended to the end of this string. + */ + defaultCommand?: string; } export interface ICommandWithParameters { @@ -695,7 +705,8 @@ export class CommandLineConfiguration { }, missingScriptBehavior: command.ignoreMissingScript ? 'log' : 'error', allowWarningsOnSuccess: !!command.allowWarningsInSuccessfulBuild, - shellCommand: command.shellCommand + shellCommand: command.shellCommand, + defaultCommand: command.defaultCommand }; if (!command.ignoreDependencyOrder) { diff --git a/libraries/rush-lib/src/api/CommandLineJson.ts b/libraries/rush-lib/src/api/CommandLineJson.ts index ba4f412176..58a5088354 100644 --- a/libraries/rush-lib/src/api/CommandLineJson.ts +++ b/libraries/rush-lib/src/api/CommandLineJson.ts @@ -29,6 +29,7 @@ export interface IBulkCommandJson extends IBaseCommandJson { allowWarningsInSuccessfulBuild?: boolean; watchForChanges?: boolean; disableBuildCache?: boolean; + defaultCommand?: string; } /** @@ -39,6 +40,7 @@ export interface IPhasedCommandWithoutPhasesJson extends IBaseCommandJson { commandKind: 'phased'; enableParallelism: boolean; incremental?: boolean; + defaultCommand?: string; } /** diff --git a/libraries/rush-lib/src/api/test/CommandLineConfiguration.test.ts b/libraries/rush-lib/src/api/test/CommandLineConfiguration.test.ts index 7bb8fe2d79..a13e69d0c7 100644 --- a/libraries/rush-lib/src/api/test/CommandLineConfiguration.test.ts +++ b/libraries/rush-lib/src/api/test/CommandLineConfiguration.test.ts @@ -294,4 +294,30 @@ describe(CommandLineConfiguration.name, () => { expect(phase.shellCommand).toEqual('echo'); }); }); + + describe('defaultCommand in bulk command', () => { + it('get "custom-shell-command-echo" command', () => { + const commandLineConfiguration: CommandLineConfiguration = new CommandLineConfiguration({ + commands: [ + { + commandKind: 'bulk', + name: 'custom-shell-command-echo', + summary: 'custom define bulk defaultCommand echo', + enableParallelism: true, + safeForSimultaneousRushProcesses: false, + defaultCommand: 'echo' + } + ] + }); + + const command: IPhasedCommandConfig | undefined = commandLineConfiguration.commands.get( + 'custom-shell-command-echo' + ) as IPhasedCommandConfig; + expect(command).toBeDefined(); + expect(command?.phases).toBeDefined(); + const phase = [...command?.phases][0]; + expect(phase.name).toEqual('custom-shell-command-echo'); + expect(phase.defaultCommand).toEqual('echo'); + }); + }); }); diff --git a/libraries/rush-lib/src/logic/operations/ShellOperationRunnerPlugin.ts b/libraries/rush-lib/src/logic/operations/ShellOperationRunnerPlugin.ts index d9a3e08a55..88ecba8bbe 100644 --- a/libraries/rush-lib/src/logic/operations/ShellOperationRunnerPlugin.ts +++ b/libraries/rush-lib/src/logic/operations/ShellOperationRunnerPlugin.ts @@ -65,7 +65,8 @@ function createShellOperations( project, phase.name, customParameterValues, - phase.shellCommand + phase.shellCommand, + phase.defaultCommand ); if (commandToRun === undefined && phase.missingScriptBehavior === 'error') { @@ -106,11 +107,12 @@ function getScriptToRun( rushProject: RushConfigurationProject, commandToRun: string, customParameterValues: ReadonlyArray, - shellCommand: string | undefined + shellCommand: string | undefined, + defaultCommand: string | undefined ): string | undefined { const { scripts } = rushProject.packageJson; - const rawCommand: string | undefined | null = shellCommand ?? scripts?.[commandToRun]; + const rawCommand: string | undefined | null = shellCommand ?? scripts?.[commandToRun] ?? defaultCommand; if (rawCommand === undefined || rawCommand === null) { return undefined; diff --git a/libraries/rush-lib/src/logic/operations/test/ShellOperationRunnerPlugin.test.ts b/libraries/rush-lib/src/logic/operations/test/ShellOperationRunnerPlugin.test.ts index 96fe059ee2..ea1e6f2f67 100644 --- a/libraries/rush-lib/src/logic/operations/test/ShellOperationRunnerPlugin.test.ts +++ b/libraries/rush-lib/src/logic/operations/test/ShellOperationRunnerPlugin.test.ts @@ -109,4 +109,91 @@ describe(ShellOperationRunnerPlugin.name, () => { // All projects expect(Array.from(operations, serializeOperation)).toMatchSnapshot(); }); + + it('defaultCommand "echo custom defaultCommand" should be set to commandToRun', async () => { + const rushJsonFile: string = path.resolve( + __dirname, + `../../test/customDefaultCommandinBulkRepo/rush.json` + ); + const commandLineJsonFile: string = path.resolve( + __dirname, + `../../test/customDefaultCommandinBulkRepo/common/config/rush/command-line.json` + ); + + const rushConfiguration = RushConfiguration.loadFromConfigurationFile(rushJsonFile); + const commandLineJson: ICommandLineJson = JsonFile.load(commandLineJsonFile); + + const commandLineConfiguration = new CommandLineConfiguration(commandLineJson); + + const echoCommand: IPhasedCommandConfig = commandLineConfiguration.commands.get( + 'echo' + )! as IPhasedCommandConfig; + + const fakeCreateOperationsContext: Pick< + ICreateOperationsContext, + 'phaseOriginal' | 'phaseSelection' | 'projectSelection' | 'projectsInUnknownState' + > = { + phaseOriginal: echoCommand.phases, + phaseSelection: echoCommand.phases, + projectSelection: new Set(rushConfiguration.projects), + projectsInUnknownState: new Set(rushConfiguration.projects) + }; + + const hooks: PhasedCommandHooks = new PhasedCommandHooks(); + + // Generates the default operation graph + new PhasedOperationPlugin().apply(hooks); + // Applies the Shell Operation Runner to selected operations + new ShellOperationRunnerPlugin().apply(hooks); + + const operations: Set = await hooks.createOperations.promise( + new Set(), + fakeCreateOperationsContext as ICreateOperationsContext + ); + // All projects + expect(Array.from(operations, serializeOperation)).toMatchSnapshot(); + }); + + it('defaultCommand priority should be lower than script name', async () => { + const rushJsonFile: string = path.resolve( + __dirname, + `../../test/customDefaultCommandinBulkOverrideScriptsRepo/rush.json` + ); + const commandLineJsonFile: string = path.resolve( + __dirname, + `../../test/customDefaultCommandinBulkOverrideScriptsRepo/common/config/rush/command-line.json` + ); + + const rushConfiguration = RushConfiguration.loadFromConfigurationFile(rushJsonFile); + const commandLineJson: ICommandLineJson = JsonFile.load(commandLineJsonFile); + + const commandLineConfiguration = new CommandLineConfiguration(commandLineJson); + const echoCommand: IPhasedCommandConfig = commandLineConfiguration.commands.get( + 'echo' + )! as IPhasedCommandConfig; + + const fakeCreateOperationsContext: Pick< + ICreateOperationsContext, + 'phaseOriginal' | 'phaseSelection' | 'projectSelection' | 'projectsInUnknownState' + > = { + phaseOriginal: echoCommand.phases, + phaseSelection: echoCommand.phases, + projectSelection: new Set(rushConfiguration.projects), + projectsInUnknownState: new Set(rushConfiguration.projects) + }; + + const hooks: PhasedCommandHooks = new PhasedCommandHooks(); + + // Generates the default operation graph + new PhasedOperationPlugin().apply(hooks); + // Applies the Shell Operation Runner to selected operations + new ShellOperationRunnerPlugin().apply(hooks); + + const operations: Set = await hooks.createOperations.promise( + new Set(), + fakeCreateOperationsContext as ICreateOperationsContext + ); + // All projects + expect(Array.from(operations, serializeOperation)).toMatchSnapshot(); + }); }); diff --git a/libraries/rush-lib/src/logic/operations/test/__snapshots__/ShellOperationRunnerPlugin.test.ts.snap b/libraries/rush-lib/src/logic/operations/test/__snapshots__/ShellOperationRunnerPlugin.test.ts.snap index f5990af4d4..4a3904b5dc 100644 --- a/libraries/rush-lib/src/logic/operations/test/__snapshots__/ShellOperationRunnerPlugin.test.ts.snap +++ b/libraries/rush-lib/src/logic/operations/test/__snapshots__/ShellOperationRunnerPlugin.test.ts.snap @@ -1,5 +1,31 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`ShellOperationRunnerPlugin defaultCommand "echo custom defaultCommand" should be set to commandToRun 1`] = ` +Array [ + Object { + "commandToRun": "echo custom defaultCommand ", + "name": "a", + }, + Object { + "commandToRun": "echo custom defaultCommand ", + "name": "b", + }, +] +`; + +exports[`ShellOperationRunnerPlugin defaultCommand priority should be lower than script name 1`] = ` +Array [ + Object { + "commandToRun": "echo custom defaultCommand ", + "name": "a", + }, + Object { + "commandToRun": "fake_echo_task_but_works_with_mock ", + "name": "b", + }, +] +`; + exports[`ShellOperationRunnerPlugin shellCommand "echo custom shellCommand" should be set to commandToRun 1`] = ` Array [ Object { diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/a/package.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/a/package.json new file mode 100644 index 0000000000..f00575e309 --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/a/package.json @@ -0,0 +1,9 @@ +{ + "name": "a", + "version": "1.0.0", + "description": "Test package a", + "scripts": { + "build": "fake_build_task_but_works_with_mock", + "rebuild": "fake_REbuild_task_but_works_with_mock" + } +} diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/b/package.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/b/package.json new file mode 100644 index 0000000000..8b915354e7 --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/b/package.json @@ -0,0 +1,10 @@ +{ + "name": "b", + "version": "1.0.0", + "description": "Test package b", + "scripts": { + "build": "fake_build_task_but_works_with_mock", + "rebuild": "fake_REbuild_task_but_works_with_mock", + "echo": "fake_echo_task_but_works_with_mock" + } +} diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/common/config/rush/command-line.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/common/config/rush/command-line.json new file mode 100644 index 0000000000..c675faf273 --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/common/config/rush/command-line.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json", + "commands": [ + { + "commandKind": "bulk", + "name": "echo", + "summary": "execute 'echo' command", + "description": "execute 'echo' command for selected project", + "enableParallelism": true, + "defaultCommand": "echo custom defaultCommand" + } + ], + "parameters": [ + { + "longName": "--flag-for-echo", + "description": "This flag should be usable for build and rebuild commands.", + "parameterKind": "flag", + "associatedCommands": ["echo"] + } + ] +} diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/rush.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/rush.json new file mode 100644 index 0000000000..f39da1606c --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkOverrideScriptsRepo/rush.json @@ -0,0 +1,17 @@ +{ + "npmVersion": "6.4.1", + "rushVersion": "5.5.2", + "projectFolderMinDepth": 1, + "projectFolderMaxDepth": 99, + + "projects": [ + { + "packageName": "a", + "projectFolder": "a" + }, + { + "packageName": "b", + "projectFolder": "b" + } + ] +} diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/a/package.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/a/package.json new file mode 100644 index 0000000000..f00575e309 --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/a/package.json @@ -0,0 +1,9 @@ +{ + "name": "a", + "version": "1.0.0", + "description": "Test package a", + "scripts": { + "build": "fake_build_task_but_works_with_mock", + "rebuild": "fake_REbuild_task_but_works_with_mock" + } +} diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/b/package.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/b/package.json new file mode 100644 index 0000000000..8f203bb691 --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/b/package.json @@ -0,0 +1,9 @@ +{ + "name": "b", + "version": "1.0.0", + "description": "Test package b", + "scripts": { + "build": "fake_build_task_but_works_with_mock", + "rebuild": "fake_REbuild_task_but_works_with_mock" + } +} diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/common/config/rush/command-line.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/common/config/rush/command-line.json new file mode 100644 index 0000000000..c675faf273 --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/common/config/rush/command-line.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json", + "commands": [ + { + "commandKind": "bulk", + "name": "echo", + "summary": "execute 'echo' command", + "description": "execute 'echo' command for selected project", + "enableParallelism": true, + "defaultCommand": "echo custom defaultCommand" + } + ], + "parameters": [ + { + "longName": "--flag-for-echo", + "description": "This flag should be usable for build and rebuild commands.", + "parameterKind": "flag", + "associatedCommands": ["echo"] + } + ] +} diff --git a/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/rush.json b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/rush.json new file mode 100644 index 0000000000..f39da1606c --- /dev/null +++ b/libraries/rush-lib/src/logic/test/customDefaultCommandinBulkRepo/rush.json @@ -0,0 +1,17 @@ +{ + "npmVersion": "6.4.1", + "rushVersion": "5.5.2", + "projectFolderMinDepth": 1, + "projectFolderMaxDepth": 99, + + "projects": [ + { + "packageName": "a", + "projectFolder": "a" + }, + { + "packageName": "b", + "projectFolder": "b" + } + ] +} diff --git a/libraries/rush-lib/src/schemas/command-line.schema.json b/libraries/rush-lib/src/schemas/command-line.schema.json index 62821dfd77..269bdeaaab 100644 --- a/libraries/rush-lib/src/schemas/command-line.schema.json +++ b/libraries/rush-lib/src/schemas/command-line.schema.json @@ -2,13 +2,13 @@ "$schema": "http://json-schema.org/draft-04/schema#", "title": "Rush command-line.json config file", "description": "For use with the Rush tool, this file defines custom command line commands. See http://rushjs.io for details.", - "definitions": { "anything": { "type": ["array", "boolean", "integer", "number", "object", "string"], - "items": { "$ref": "#/definitions/anything" } + "items": { + "$ref": "#/definitions/anything" + } }, - "baseCommand": { "type": "object", "additionalProperties": true, @@ -47,7 +47,9 @@ "description": "A custom command that is run separately for each project in the repository", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseCommand" }, + { + "$ref": "#/definitions/baseCommand" + }, { "type": "object", "additionalProperties": true, @@ -61,6 +63,11 @@ "description": "(Optional) If the \"shellCommand\" field is set for a bulk command, Rush will invoke it for each selected project; otherwise, Rush will invoke the package.json \"scripts\" entry matching Rush command name.\n\nThe string is the path to a script that will be invoked using the OS shell. The working directory will be the folder that contains rush.json. If custom parameters are associated with this command, their values will be appended to the end of this string.", "type": "string" }, + "defaultCommand": { + "title": "Default Command", + "description": "(Optional) If the \"defaultCommand\" field is set for a bulk command, when Rush can't find the package.json \"script\" entry matching Rush command/phase name, it will fall back to this command.\n\nThe string is the path to a script that will be invoked using the OS shell. The working directory will be the folder that contains rush.json. If custom parameters are associated with this command, their values will be appended to the end of this string.", + "type": "string" + }, "enableParallelism": { "title": "enableParallelism", "description": "If true then this command can be run in parallel, i.e. executed simultaneously for multiple projects.", @@ -102,20 +109,48 @@ "type": "object", "additionalProperties": false, "properties": { - "commandKind": { "$ref": "#/definitions/anything" }, - "name": { "$ref": "#/definitions/anything" }, - "summary": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "safeForSimultaneousRushProcesses": { "$ref": "#/definitions/anything" }, - "shellCommand": { "$ref": "#/definitions/anything" }, - - "enableParallelism": { "$ref": "#/definitions/anything" }, - "ignoreDependencyOrder": { "$ref": "#/definitions/anything" }, - "ignoreMissingScript": { "$ref": "#/definitions/anything" }, - "incremental": { "$ref": "#/definitions/anything" }, - "allowWarningsInSuccessfulBuild": { "$ref": "#/definitions/anything" }, - "watchForChanges": { "$ref": "#/definitions/anything" }, - "disableBuildCache": { "$ref": "#/definitions/anything" } + "commandKind": { + "$ref": "#/definitions/anything" + }, + "name": { + "$ref": "#/definitions/anything" + }, + "summary": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "safeForSimultaneousRushProcesses": { + "$ref": "#/definitions/anything" + }, + "shellCommand": { + "$ref": "#/definitions/anything" + }, + "defaultCommand": { + "$ref": "#/definitions/anything" + }, + "enableParallelism": { + "$ref": "#/definitions/anything" + }, + "ignoreDependencyOrder": { + "$ref": "#/definitions/anything" + }, + "ignoreMissingScript": { + "$ref": "#/definitions/anything" + }, + "incremental": { + "$ref": "#/definitions/anything" + }, + "allowWarningsInSuccessfulBuild": { + "$ref": "#/definitions/anything" + }, + "watchForChanges": { + "$ref": "#/definitions/anything" + }, + "disableBuildCache": { + "$ref": "#/definitions/anything" + } } } ] @@ -125,7 +160,9 @@ "description": "A custom command that is run once for the entire repository", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseCommand" }, + { + "$ref": "#/definitions/baseCommand" + }, { "type": "object", "additionalProperties": true, @@ -150,14 +187,27 @@ "type": "object", "additionalProperties": false, "properties": { - "commandKind": { "$ref": "#/definitions/anything" }, - "name": { "$ref": "#/definitions/anything" }, - "summary": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "safeForSimultaneousRushProcesses": { "$ref": "#/definitions/anything" }, - - "shellCommand": { "$ref": "#/definitions/anything" }, - "autoinstallerName": { "$ref": "#/definitions/anything" } + "commandKind": { + "$ref": "#/definitions/anything" + }, + "name": { + "$ref": "#/definitions/anything" + }, + "summary": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "safeForSimultaneousRushProcesses": { + "$ref": "#/definitions/anything" + }, + "shellCommand": { + "$ref": "#/definitions/anything" + }, + "autoinstallerName": { + "$ref": "#/definitions/anything" + } } } ] @@ -167,7 +217,9 @@ "description": "A command that contains multiple phases, that are run separately for each project", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseCommand" }, + { + "$ref": "#/definitions/baseCommand" + }, { "type": "object", "additionalProperties": true, @@ -241,22 +293,40 @@ "type": "object", "additionalProperties": false, "properties": { - "commandKind": { "$ref": "#/definitions/anything" }, - "name": { "$ref": "#/definitions/anything" }, - "summary": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "safeForSimultaneousRushProcesses": { "$ref": "#/definitions/anything" }, - - "enableParallelism": { "$ref": "#/definitions/anything" }, - "incremental": { "$ref": "#/definitions/anything" }, - "phases": { "$ref": "#/definitions/anything" }, - "watchOptions": { "$ref": "#/definitions/anything" }, - "installOptions": { "$ref": "#/definitions/anything" } + "commandKind": { + "$ref": "#/definitions/anything" + }, + "name": { + "$ref": "#/definitions/anything" + }, + "summary": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "safeForSimultaneousRushProcesses": { + "$ref": "#/definitions/anything" + }, + "enableParallelism": { + "$ref": "#/definitions/anything" + }, + "incremental": { + "$ref": "#/definitions/anything" + }, + "phases": { + "$ref": "#/definitions/anything" + }, + "watchOptions": { + "$ref": "#/definitions/anything" + }, + "installOptions": { + "$ref": "#/definitions/anything" + } } } ] }, - "phase": { "title": "Phase", "description": "A phase, used in the phased command feature.", @@ -269,7 +339,6 @@ "description": "The name of the phase. Note that this value must start with the \"_phase:\" prefix.", "type": "string" }, - "dependencies": { "title": "Dependencies", "description": "The dependencies of this phase.", @@ -296,19 +365,16 @@ } } }, - "ignoreMissingScript": { "title": "Ignore Missing Script", "description": "Normally Rush requires that each project's package.json has a \"scripts\" entry matching the phase name. To disable this check, set \"ignoreMissingScript\" to true.", "type": "boolean" }, - "allowWarningsOnSuccess": { "title": "Allow Warnings on Success", "description": "By default, Rush returns a nonzero exit code if errors or warnings occur during a command. If this option is set to \"true\", Rush will return a zero exit code if warnings occur during the execution of this phase.", "type": "boolean" }, - "missingScriptBehavior": { "title": "Missing Script Behavior", "description": "What should happen if a project's package.json does not have a \"scripts\" entry matching the phase name, or it is an empty string. Supersedes \"ignoreMissingScript\". Defaults to \"error\".", @@ -317,7 +383,6 @@ } } }, - "baseParameter": { "type": "object", "additionalProperties": true, @@ -374,7 +439,9 @@ "description": "A custom command-line parameter whose presence acts as an on/off switch", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseParameter" }, + { + "$ref": "#/definitions/baseParameter" + }, { "type": "object", "additionalProperties": true, @@ -388,13 +455,27 @@ "type": "object", "additionalProperties": false, "properties": { - "parameterKind": { "$ref": "#/definitions/anything" }, - "longName": { "$ref": "#/definitions/anything" }, - "shortName": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "associatedCommands": { "$ref": "#/definitions/anything" }, - "associatedPhases": { "$ref": "#/definitions/anything" }, - "required": { "$ref": "#/definitions/anything" } + "parameterKind": { + "$ref": "#/definitions/anything" + }, + "longName": { + "$ref": "#/definitions/anything" + }, + "shortName": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "associatedCommands": { + "$ref": "#/definitions/anything" + }, + "associatedPhases": { + "$ref": "#/definitions/anything" + }, + "required": { + "$ref": "#/definitions/anything" + } } } ] @@ -404,7 +485,9 @@ "description": "A custom command-line parameter whose value is interpreted as a string", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseParameter" }, + { + "$ref": "#/definitions/baseParameter" + }, { "type": "object", "additionalProperties": true, @@ -424,15 +507,30 @@ "type": "object", "additionalProperties": false, "properties": { - "parameterKind": { "$ref": "#/definitions/anything" }, - "longName": { "$ref": "#/definitions/anything" }, - "shortName": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "associatedCommands": { "$ref": "#/definitions/anything" }, - "associatedPhases": { "$ref": "#/definitions/anything" }, - "required": { "$ref": "#/definitions/anything" }, - - "argumentName": { "$ref": "#/definitions/anything" } + "parameterKind": { + "$ref": "#/definitions/anything" + }, + "longName": { + "$ref": "#/definitions/anything" + }, + "shortName": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "associatedCommands": { + "$ref": "#/definitions/anything" + }, + "associatedPhases": { + "$ref": "#/definitions/anything" + }, + "required": { + "$ref": "#/definitions/anything" + }, + "argumentName": { + "$ref": "#/definitions/anything" + } } } ] @@ -442,7 +540,9 @@ "description": "A custom command-line parameter whose argument must be chosen from a list of allowable alternatives", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseParameter" }, + { + "$ref": "#/definitions/baseParameter" + }, { "type": "object", "additionalProperties": true, @@ -485,16 +585,33 @@ "type": "object", "additionalProperties": false, "properties": { - "parameterKind": { "$ref": "#/definitions/anything" }, - "longName": { "$ref": "#/definitions/anything" }, - "shortName": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "associatedCommands": { "$ref": "#/definitions/anything" }, - "associatedPhases": { "$ref": "#/definitions/anything" }, - "required": { "$ref": "#/definitions/anything" }, - - "alternatives": { "$ref": "#/definitions/anything" }, - "defaultValue": { "$ref": "#/definitions/anything" } + "parameterKind": { + "$ref": "#/definitions/anything" + }, + "longName": { + "$ref": "#/definitions/anything" + }, + "shortName": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "associatedCommands": { + "$ref": "#/definitions/anything" + }, + "associatedPhases": { + "$ref": "#/definitions/anything" + }, + "required": { + "$ref": "#/definitions/anything" + }, + "alternatives": { + "$ref": "#/definitions/anything" + }, + "defaultValue": { + "$ref": "#/definitions/anything" + } } } ] @@ -504,7 +621,9 @@ "description": "A custom command-line parameter whose value is interpreted as a integer", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseParameter" }, + { + "$ref": "#/definitions/baseParameter" + }, { "type": "object", "additionalProperties": true, @@ -524,15 +643,30 @@ "type": "object", "additionalProperties": false, "properties": { - "parameterKind": { "$ref": "#/definitions/anything" }, - "longName": { "$ref": "#/definitions/anything" }, - "shortName": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "associatedCommands": { "$ref": "#/definitions/anything" }, - "associatedPhases": { "$ref": "#/definitions/anything" }, - "required": { "$ref": "#/definitions/anything" }, - - "argumentName": { "$ref": "#/definitions/anything" } + "parameterKind": { + "$ref": "#/definitions/anything" + }, + "longName": { + "$ref": "#/definitions/anything" + }, + "shortName": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "associatedCommands": { + "$ref": "#/definitions/anything" + }, + "associatedPhases": { + "$ref": "#/definitions/anything" + }, + "required": { + "$ref": "#/definitions/anything" + }, + "argumentName": { + "$ref": "#/definitions/anything" + } } } ] @@ -542,7 +676,9 @@ "description": "A custom command-line parameter whose value is interpreted as a list of string", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseParameter" }, + { + "$ref": "#/definitions/baseParameter" + }, { "type": "object", "additionalProperties": true, @@ -562,15 +698,30 @@ "type": "object", "additionalProperties": false, "properties": { - "parameterKind": { "$ref": "#/definitions/anything" }, - "longName": { "$ref": "#/definitions/anything" }, - "shortName": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "associatedCommands": { "$ref": "#/definitions/anything" }, - "associatedPhases": { "$ref": "#/definitions/anything" }, - "required": { "$ref": "#/definitions/anything" }, - - "argumentName": { "$ref": "#/definitions/anything" } + "parameterKind": { + "$ref": "#/definitions/anything" + }, + "longName": { + "$ref": "#/definitions/anything" + }, + "shortName": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "associatedCommands": { + "$ref": "#/definitions/anything" + }, + "associatedPhases": { + "$ref": "#/definitions/anything" + }, + "required": { + "$ref": "#/definitions/anything" + }, + "argumentName": { + "$ref": "#/definitions/anything" + } } } ] @@ -580,7 +731,9 @@ "description": "A custom command-line parameter whose value is interpreted as a list of integer", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseParameter" }, + { + "$ref": "#/definitions/baseParameter" + }, { "type": "object", "additionalProperties": true, @@ -600,15 +753,30 @@ "type": "object", "additionalProperties": false, "properties": { - "parameterKind": { "$ref": "#/definitions/anything" }, - "longName": { "$ref": "#/definitions/anything" }, - "shortName": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "associatedCommands": { "$ref": "#/definitions/anything" }, - "associatedPhases": { "$ref": "#/definitions/anything" }, - "required": { "$ref": "#/definitions/anything" }, - - "argumentName": { "$ref": "#/definitions/anything" } + "parameterKind": { + "$ref": "#/definitions/anything" + }, + "longName": { + "$ref": "#/definitions/anything" + }, + "shortName": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "associatedCommands": { + "$ref": "#/definitions/anything" + }, + "associatedPhases": { + "$ref": "#/definitions/anything" + }, + "required": { + "$ref": "#/definitions/anything" + }, + "argumentName": { + "$ref": "#/definitions/anything" + } } } ] @@ -618,7 +786,9 @@ "description": "A custom command-line parameter whose argument must be chosen from a list of allowable alternatives, value is interpreted as a list of choice", "type": "object", "allOf": [ - { "$ref": "#/definitions/baseParameter" }, + { + "$ref": "#/definitions/baseParameter" + }, { "type": "object", "additionalProperties": true, @@ -661,31 +831,45 @@ "type": "object", "additionalProperties": false, "properties": { - "parameterKind": { "$ref": "#/definitions/anything" }, - "longName": { "$ref": "#/definitions/anything" }, - "shortName": { "$ref": "#/definitions/anything" }, - "description": { "$ref": "#/definitions/anything" }, - "associatedCommands": { "$ref": "#/definitions/anything" }, - "associatedPhases": { "$ref": "#/definitions/anything" }, - "required": { "$ref": "#/definitions/anything" }, - - "alternatives": { "$ref": "#/definitions/anything" }, - "defaultValue": { "$ref": "#/definitions/anything" } + "parameterKind": { + "$ref": "#/definitions/anything" + }, + "longName": { + "$ref": "#/definitions/anything" + }, + "shortName": { + "$ref": "#/definitions/anything" + }, + "description": { + "$ref": "#/definitions/anything" + }, + "associatedCommands": { + "$ref": "#/definitions/anything" + }, + "associatedPhases": { + "$ref": "#/definitions/anything" + }, + "required": { + "$ref": "#/definitions/anything" + }, + "alternatives": { + "$ref": "#/definitions/anything" + }, + "defaultValue": { + "$ref": "#/definitions/anything" + } } } ] } }, - "type": "object", "additionalProperties": false, - "properties": { "$schema": { "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.", "type": "string" }, - "commands": { "title": "Custom Commands", "description": "A list of custom commands that affect all projects in the repository. These commands are invoked from the Rush command line.", @@ -693,13 +877,18 @@ "items": { "type": "object", "oneOf": [ - { "$ref": "#/definitions/bulkCommand" }, - { "$ref": "#/definitions/globalCommand" }, - { "$ref": "#/definitions/phasedCommand" } + { + "$ref": "#/definitions/bulkCommand" + }, + { + "$ref": "#/definitions/globalCommand" + }, + { + "$ref": "#/definitions/phasedCommand" + } ] } }, - "phases": { "title": "Phases", "description": "A list of phases that are associated with phased commands.", @@ -708,7 +897,6 @@ "$ref": "#/definitions/phase" } }, - "parameters": { "title": "Custom Parameters", "description": "A list of custom command-line parameters that can be associated with custom commands and Rush's built-in commands.", @@ -716,13 +904,27 @@ "items": { "type": "object", "oneOf": [ - { "$ref": "#/definitions/flagParameter" }, - { "$ref": "#/definitions/choiceParameter" }, - { "$ref": "#/definitions/stringParameter" }, - { "$ref": "#/definitions/integerParameter" }, - { "$ref": "#/definitions/stringListParameter" }, - { "$ref": "#/definitions/integerListParameter" }, - { "$ref": "#/definitions/choiceListParameter" } + { + "$ref": "#/definitions/flagParameter" + }, + { + "$ref": "#/definitions/choiceParameter" + }, + { + "$ref": "#/definitions/stringParameter" + }, + { + "$ref": "#/definitions/integerParameter" + }, + { + "$ref": "#/definitions/stringListParameter" + }, + { + "$ref": "#/definitions/integerListParameter" + }, + { + "$ref": "#/definitions/choiceListParameter" + } ] } }