Skip to content

Commit 904e698

Browse files
authored
Merge pull request microsoft#722 from ThomasMichon/variants
[rush] Add 'variants' feature to Rush
2 parents dbe7f77 + 63bb70e commit 904e698

38 files changed

Lines changed: 588 additions & 160 deletions

.vscode/launch.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,33 @@
2121
"sourceMaps": false,
2222
"outDir": null
2323
},
24+
{
25+
"name": "Rush Debug",
26+
"type": "node",
27+
"request": "launch",
28+
"program": "${workspaceRoot}/apps/rush-lib/lib/start.js",
29+
"stopOnEntry": true,
30+
"args": [
31+
"update",
32+
"--variant",
33+
"test"
34+
],
35+
"cwd": "${workspaceRoot}",
36+
"runtimeExecutable": null,
37+
"runtimeArgs": [
38+
"--nolazy",
39+
"--debug"
40+
],
41+
"env": {
42+
"NODE_ENV": "development"
43+
},
44+
"sourceMaps": true
45+
},
2446
{
2547
"name": "Attach",
2648
"type": "node",
2749
"request": "attach",
2850
"port": 5858
2951
}
3052
]
31-
}
53+
}

apps/rush-lib/assets/rush-init/rush.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,39 @@
203203
"postRushBuild": []
204204
},
205205

206+
/**
207+
* Installation variants allow you to maintain a parallel set of configuration files that can be
208+
* used to build the entire monorepo with an alternate set of dependencies. For example, suppose
209+
* you upgrade all your projects to use a new release of an important framework, but during a transition period
210+
* you intend to maintain compability with the old release. In this situation, you probably want your
211+
* CI validation to build the entire repo twice: once with the old release, and once with the new release.
212+
*
213+
* Rush "installation variants" correspond to sets of config files located under this folder:
214+
*
215+
* common/config/rush/variants/<variant_name>
216+
*
217+
* The variant folder can contain an alternate common-versions.json file. Its "preferredVersions" field can be used
218+
* to select older versions of dependencies (within a loose SemVer range specified in your package.json files).
219+
* To install a variant, run "rush install --variant <variant_name>".
220+
*
221+
* For more details and instructions, see this article: https://rushjs.io/pages/advanced/installation_variants/
222+
*/
223+
"variants": [
224+
/*[BEGIN "HYPOTHETICAL"]*/
225+
{
226+
/**
227+
* The folder name for this variant.
228+
*/
229+
"variantName": "old-sdk",
230+
231+
/**
232+
* An informative description
233+
*/
234+
"description": "Build this repo using the previous release of the SDK"
235+
}
236+
/*[END "HYPOTHETICAL"]*/
237+
],
238+
206239
/**
207240
* Rush can collect anonymous telemetry about everyday developer activity such as
208241
* success/failure of installs, builds, and other operations. You can use this to identify

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414

1515
/**
1616
* This class represents a single change file.
17-
* @public
1817
*/
1918
export class ChangeFile {
2019
private _changeFileData: IChangeFile;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
/**
55
* Representation for a changes file
6-
* @public
76
*/
87
export interface IChangeFile {
98
changes: IChangeInfo[];
@@ -13,7 +12,6 @@ export interface IChangeFile {
1312

1413
/**
1514
* Represents all of the types of change requests.
16-
* @public
1715
*/
1816
export enum ChangeType {
1917
none = 0,
@@ -26,7 +24,6 @@ export enum ChangeType {
2624

2725
/**
2826
* Defines an IChangeInfo object.
29-
* @public
3027
*/
3128
export interface IChangeInfo {
3229
/**

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
14
/**
25
* Interface respresenting a changelog json object for a package used to represent the parsed
36
* content of CHANGELOG.json
4-
*
5-
* @beta
67
*/
78
export interface IChangelog {
89
/**
@@ -18,8 +19,6 @@ export interface IChangelog {
1819

1920
/**
2021
* Interface representing a single published entry in the changelog.
21-
*
22-
* @beta
2322
*/
2423
export interface IChangeLogEntry {
2524
/**
@@ -56,8 +55,6 @@ export interface IChangeLogEntry {
5655

5756
/**
5857
* Interface representing a single changelog comment within an entry.
59-
*
60-
* @beta
6158
*/
6259
export interface IChangeLogComment {
6360
/**

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919

2020
/**
2121
* Custom Commands and Options for the Rush Command Line
22-
* @public
2322
*/
2423
export class CommandLineConfiguration {
2524
private static _jsonSchema: JsonSchema = JsonSchema.fromFile(

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as os from 'os';
1010
export const enum EnvironmentVariableNames {
1111
/**
1212
* This variable overrides the temporary folder used by Rush.
13-
* The default value is "common/temp" under the repoistory root.
13+
* The default value is "common/temp" under the repository root.
1414
*/
1515
RUSH_TEMP_FOLDER = 'RUSH_TEMP_FOLDER',
1616

@@ -19,7 +19,14 @@ export const enum EnvironmentVariableNames {
1919
* the version selector. The default value is determined by the "rushVersion"
2020
* field from rush.json.
2121
*/
22-
RUSH_PREVIEW_VERSION = 'RUSH_PREVIEW_VERSION'
22+
RUSH_PREVIEW_VERSION = 'RUSH_PREVIEW_VERSION',
23+
24+
/**
25+
* This variable selects a specific installation variant for Rush to use when installing
26+
* and linking package dependencies. For more information, see this article:
27+
* https://rushjs.io/pages/advanced/installation_variants/
28+
*/
29+
RUSH_VARIANT = 'RUSH_VARIANT'
2330
}
2431

2532
/**
@@ -60,6 +67,7 @@ export class EnvironmentConfiguration {
6067
break;
6168

6269
case EnvironmentVariableNames.RUSH_PREVIEW_VERSION:
70+
case EnvironmentVariableNames.RUSH_VARIANT:
6371
// Handled by @microsoft/rush front end
6472
break;
6573
default:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export class Rush {
6464
/**
6565
* The currently executing version of the "rush-lib" library.
6666
* This is the same as the Rush tool version for that release.
67-
* @public
6867
*/
6968
public static get version(): string {
7069
if (!Rush._version) {

0 commit comments

Comments
 (0)