Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] Add support for an --ignore-engines runtime flag #1084

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/rush-lib/src/cli/RushCommandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class RushCommandLineParser extends CommandLineParser {
public rushGlobalFolder: RushGlobalFolder;

private _debugParameter: CommandLineFlagParameter;
private _ignoreEnginesParameter: CommandLineFlagParameter;

constructor() {
super({
Expand All @@ -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();
Expand All @@ -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<void> {
Expand Down
1 change: 1 addition & 0 deletions apps/rush-lib/src/cli/actions/InstallAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
Expand Down
8 changes: 8 additions & 0 deletions apps/rush-lib/src/logic/InstallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand Down Expand Up @@ -1146,6 +1150,10 @@ export class InstallManager {
args.push('--network-concurrency', options.networkConcurrency.toString());
}
}

if (options.ignoreEngines) {
args.push('--ignore-engines');
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "Add support for an --ignore-engines runtime flag",
"packageName": "@microsoft/rush",
"type": "none"
}
],
"packageName": "@microsoft/rush",
"email": "[email protected]"
}