Skip to content

Commit cb7063f

Browse files
authored
Merge branch 'master' into ianc/documentation-for-StringBufferTerminalProvider
2 parents aae6b42 + ba6fc44 commit cb7063f

6 files changed

Lines changed: 80 additions & 2 deletions

File tree

apps/rush-lib/src/api/RushConfiguration.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ export interface IPnpmOptionsJson {
8282
strictPeerDependencies?: boolean;
8383
}
8484

85+
/**
86+
* Part of IRushConfigurationJson.
87+
*/
88+
export interface IYarnOptionsJson {
89+
ignoreEngines?: boolean;
90+
}
91+
8592
/**
8693
* Options defining an allowed variant as part of IRushConfigurationJson.
8794
*/
@@ -111,6 +118,7 @@ export interface IRushConfigurationJson {
111118
eventHooks?: IEventHooksJson;
112119
hotfixChangeEnabled?: boolean;
113120
pnpmOptions?: IPnpmOptionsJson;
121+
yarnOptions?: IYarnOptionsJson;
114122
ensureConsistentVersions?: boolean;
115123
variants?: IRushVariantOptionsJson[];
116124
}
@@ -158,6 +166,31 @@ export class PnpmOptionsConfiguration {
158166
}
159167
}
160168

169+
/**
170+
* Options that are only used when the yarn package manager is selected.
171+
*
172+
* @remarks
173+
* It is valid to define these options in rush.json even if the yarn package manager
174+
* is not being used.
175+
*
176+
* @public
177+
*/
178+
export class YarnOptionsConfiguration {
179+
/**
180+
* If true, then Rush will add the "--ignore-engines" option when invoking Yarn.
181+
* This allows "rush install" to succeed if there are dependencies with engines defined in
182+
* package.json which do not match the current environment.
183+
*
184+
* The default value is false.
185+
*/
186+
public readonly ignoreEngines: boolean;
187+
188+
/** @internal */
189+
public constructor(json: IYarnOptionsJson) {
190+
this.ignoreEngines = !!json.ignoreEngines;
191+
}
192+
}
193+
161194
/**
162195
* This represents the available Package Manager tools as a string
163196
* @public
@@ -211,6 +244,7 @@ export class RushConfiguration {
211244
private _repositoryUrl: string;
212245

213246
private _pnpmOptions: PnpmOptionsConfiguration;
247+
private _yarnOptions: YarnOptionsConfiguration;
214248

215249
// Rush hooks
216250
private _eventHooks: EventHooks;
@@ -695,6 +729,13 @@ export class RushConfiguration {
695729
return this._pnpmOptions;
696730
}
697731

732+
/**
733+
* {@inheritdoc YarnOptionsConfiguration}
734+
*/
735+
public get yarnOptions(): YarnOptionsConfiguration {
736+
return this._yarnOptions;
737+
}
738+
698739
/**
699740
* Settings from the common-versions.json config file.
700741
* @remarks
@@ -905,7 +946,8 @@ export class RushConfiguration {
905946

906947
this._ensureConsistentVersions = !!rushConfigurationJson.ensureConsistentVersions;
907948

908-
this._pnpmOptions = new PnpmOptionsConfiguration(rushConfigurationJson.pnpmOptions || { });
949+
this._pnpmOptions = new PnpmOptionsConfiguration(rushConfigurationJson.pnpmOptions || {});
950+
this._yarnOptions = new YarnOptionsConfiguration(rushConfigurationJson.yarnOptions || { });
909951

910952
// TODO: Add an actual "packageManager" field in rush.json
911953
const packageManagerFields: string[] = [];

apps/rush-lib/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export {
1313
export {
1414
RushConfiguration,
1515
PackageManager,
16-
PnpmOptionsConfiguration
16+
PnpmOptionsConfiguration,
17+
YarnOptionsConfiguration
1718
} from './api/RushConfiguration';
1819

1920
export {

apps/rush-lib/src/logic/InstallManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,10 @@ export class InstallManager {
11451145
if (options.networkConcurrency) {
11461146
args.push('--network-concurrency', options.networkConcurrency.toString());
11471147
}
1148+
1149+
if (this._rushConfiguration.yarnOptions.ignoreEngines) {
1150+
args.push('--ignore-engines');
1151+
}
11481152
}
11491153
}
11501154

apps/rush-lib/src/schemas/rush.schema.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@
6060
},
6161
"additionalProperties": false
6262
},
63+
"yarnOptions": {
64+
"description": "Options that are only used when the Yarn pacakge manager is selected.",
65+
"type": "object",
66+
"properties": {
67+
"ignoreEngines": {
68+
"description": "If true, then Rush will add the \"--ignore-engines\" option when invoking Yarn. * This allows \"rush install\" to succeed if there are dependencies with engines defined in package.json which do not match the current environment. The default value is false.",
69+
"type": "boolean"
70+
}
71+
},
72+
"additionalProperties": false
73+
},
6374
"projectFolderMaxDepth": {
6475
"description": "The maximum folder depth for the projectFolder field. The default value is 2, i.e. a single slash in the path name.",
6576
"type": "number"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Add support for Yarn options with the --ignore-engines flag",
5+
"packageName": "@microsoft/rush",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "kevingrandon@yahoo.com"
11+
}

common/reviews/api/rush-lib.api.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ declare class RushConfiguration {
246246
// @beta (undocumented)
247247
readonly versionPolicyConfiguration: VersionPolicyConfiguration;
248248
readonly yarnCacheFolder: string;
249+
// (undocumented)
250+
readonly yarnOptions: YarnOptionsConfiguration;
249251
}
250252

251253
// @public
@@ -317,3 +319,10 @@ declare enum VersionPolicyDefinitionName {
317319
'lockStepVersion' = 0
318320
}
319321

322+
// @public
323+
declare class YarnOptionsConfiguration {
324+
// @internal (undocumented)
325+
constructor(json: IYarnOptionsJson);
326+
readonly ignoreEngines: boolean;
327+
}
328+

0 commit comments

Comments
 (0)