From 51f29ddd6609892ba896623f49958b73e8570d5f Mon Sep 17 00:00:00 2001 From: Kevin Grandon Date: Wed, 6 Feb 2019 14:15:10 -0800 Subject: [PATCH 1/4] [rush] Add support for an --ignore-engines runtime flag --- apps/rush-lib/src/cli/RushCommandLineParser.ts | 9 +++++++++ apps/rush-lib/src/cli/actions/InstallAction.ts | 1 + apps/rush-lib/src/logic/InstallManager.ts | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/apps/rush-lib/src/cli/RushCommandLineParser.ts b/apps/rush-lib/src/cli/RushCommandLineParser.ts index e8c11c1f23d..53206f2e174 100644 --- a/apps/rush-lib/src/cli/RushCommandLineParser.ts +++ b/apps/rush-lib/src/cli/RushCommandLineParser.ts @@ -39,6 +39,7 @@ export class RushCommandLineParser extends CommandLineParser { public rushGlobalFolder: RushGlobalFolder; private _debugParameter: CommandLineFlagParameter; + private _ignoreEnginesParameter: CommandLineFlagParameter; constructor() { super({ @@ -59,6 +60,10 @@ export class RushCommandLineParser extends CommandLineParser { return this._debugParameter.value; } + public get isIgnoreEngines(): boolean { + return this._ignoreEnginesParameter.value; + } + public flushTelemetry(): void { if (this.telemetry) { this.telemetry.flush(); @@ -71,6 +76,10 @@ export class RushCommandLineParser extends CommandLineParser { parameterShortName: '-d', description: 'Show the full call stack if an error occurs while executing the tool' }); + this._ignoreEnginesParameter = this.defineFlagParameter({ + parameterLongName: '--ignore-engines', + description: 'Ignores engines section in package.json for yarn and npm package managers', + }); } protected onExecute(): Promise { diff --git a/apps/rush-lib/src/cli/actions/InstallAction.ts b/apps/rush-lib/src/cli/actions/InstallAction.ts index 0e50a076ed9..8ad54d7aefc 100644 --- a/apps/rush-lib/src/cli/actions/InstallAction.ts +++ b/apps/rush-lib/src/cli/actions/InstallAction.ts @@ -27,6 +27,7 @@ export class InstallAction extends BaseInstallAction { protected buildInstallOptions(): IInstallManagerOptions { return { debug: this.parser.isDebug, + ignoreEngines: this.parser.isIgnoreEngines, allowShrinkwrapUpdates: false, bypassPolicy: this._bypassPolicyParameter.value!, noLink: this._noLinkParameter.value!, diff --git a/apps/rush-lib/src/logic/InstallManager.ts b/apps/rush-lib/src/logic/InstallManager.ts index 604a9bc11e3..90c53835926 100644 --- a/apps/rush-lib/src/logic/InstallManager.ts +++ b/apps/rush-lib/src/logic/InstallManager.ts @@ -69,6 +69,10 @@ export interface IInstallManagerOptions { * Whether the global "--debug" flag was specified. */ debug: boolean; + /** + * Whether the global "--ignore-engines" flag was specified. + */ + ignoreEngines: boolean; /** * Whether or not Rush will automatically update the shrinkwrap file. * True for "rush update", false for "rush install". @@ -1146,6 +1150,10 @@ export class InstallManager { args.push('--network-concurrency', options.networkConcurrency.toString()); } } + + if (options.ignoreEngines) { + args.push('--ignore-engines'); + } } /** From ef33d7581754e5d9b08898002eb75e824dec5726 Mon Sep 17 00:00:00 2001 From: Kevin Grandon Date: Wed, 6 Feb 2019 14:20:02 -0800 Subject: [PATCH 2/4] Add changelog --- .../rush/add-ignore-engines_2019-02-06-22-19.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@microsoft/rush/add-ignore-engines_2019-02-06-22-19.json diff --git a/common/changes/@microsoft/rush/add-ignore-engines_2019-02-06-22-19.json b/common/changes/@microsoft/rush/add-ignore-engines_2019-02-06-22-19.json new file mode 100644 index 00000000000..b88ad1502c1 --- /dev/null +++ b/common/changes/@microsoft/rush/add-ignore-engines_2019-02-06-22-19.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "Add support for an --ignore-engines runtime flag", + "packageName": "@microsoft/rush", + "type": "none" + } + ], + "packageName": "@microsoft/rush", + "email": "kevingrandon@yahoo.com" +} \ No newline at end of file From 5ccbe54179673ac9d9e8c568ea7f842c2329f18b Mon Sep 17 00:00:00 2001 From: Kevin Grandon Date: Wed, 6 Feb 2019 14:34:19 -0800 Subject: [PATCH 3/4] Make ignoreEngines optional --- apps/rush-lib/src/logic/InstallManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/rush-lib/src/logic/InstallManager.ts b/apps/rush-lib/src/logic/InstallManager.ts index 90c53835926..6d6715ff5d4 100644 --- a/apps/rush-lib/src/logic/InstallManager.ts +++ b/apps/rush-lib/src/logic/InstallManager.ts @@ -72,7 +72,7 @@ export interface IInstallManagerOptions { /** * Whether the global "--ignore-engines" flag was specified. */ - ignoreEngines: boolean; + ignoreEngines?: boolean; /** * Whether or not Rush will automatically update the shrinkwrap file. * True for "rush update", false for "rush install". From 38328a0db0d19078a80797534a5d36a14f554580 Mon Sep 17 00:00:00 2001 From: Kevin Grandon Date: Wed, 6 Feb 2019 15:06:31 -0800 Subject: [PATCH 4/4] Lint --- apps/rush-lib/src/cli/RushCommandLineParser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/rush-lib/src/cli/RushCommandLineParser.ts b/apps/rush-lib/src/cli/RushCommandLineParser.ts index 53206f2e174..51ab2964d1f 100644 --- a/apps/rush-lib/src/cli/RushCommandLineParser.ts +++ b/apps/rush-lib/src/cli/RushCommandLineParser.ts @@ -78,7 +78,7 @@ export class RushCommandLineParser extends CommandLineParser { }); this._ignoreEnginesParameter = this.defineFlagParameter({ parameterLongName: '--ignore-engines', - description: 'Ignores engines section in package.json for yarn and npm package managers', + description: 'Ignores engines section in package.json for yarn and npm package managers' }); }