@microsoft/rush 5.168.0 → 5.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +21 -0
- package/CHANGELOG.md +11 -1
- package/bin/rush +1 -1
- package/bin/rush-pnpm +1 -1
- package/bin/rushx +1 -1
- package/{lib → lib-commonjs}/RushCommandSelector.js +2 -4
- package/lib-commonjs/RushCommandSelector.js.map +1 -0
- package/{lib → lib-commonjs}/RushVersionSelector.js +9 -2
- package/lib-commonjs/RushVersionSelector.js.map +1 -0
- package/{lib → lib-commonjs}/start.js.map +1 -1
- package/{lib → lib-dts}/RushCommandSelector.d.ts +2 -2
- package/lib-dts/RushCommandSelector.d.ts.map +1 -0
- package/{lib → lib-dts}/RushVersionSelector.d.ts.map +1 -1
- package/lib-esm/MinimalRushConfiguration.js +58 -0
- package/lib-esm/MinimalRushConfiguration.js.map +1 -0
- package/lib-esm/RushCommandSelector.js +70 -0
- package/lib-esm/RushCommandSelector.js.map +1 -0
- package/lib-esm/RushVersionSelector.js +80 -0
- package/lib-esm/RushVersionSelector.js.map +1 -0
- package/lib-esm/start.js +72 -0
- package/lib-esm/start.js.map +1 -0
- package/package.json +27 -8
- package/lib/RushCommandSelector.d.ts.map +0 -1
- package/lib/RushCommandSelector.js.map +0 -1
- package/lib/RushVersionSelector.js.map +0 -1
- /package/{lib → lib-commonjs}/MinimalRushConfiguration.js +0 -0
- /package/{lib → lib-commonjs}/MinimalRushConfiguration.js.map +0 -0
- /package/{lib → lib-commonjs}/start.js +0 -0
- /package/{lib → lib-dts}/MinimalRushConfiguration.d.ts +0 -0
- /package/{lib → lib-dts}/MinimalRushConfiguration.d.ts.map +0 -0
- /package/{lib → lib-dts}/RushVersionSelector.d.ts +0 -0
- /package/{lib → lib-dts}/start.d.ts +0 -0
- /package/{lib → lib-dts}/start.d.ts.map +0 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rush",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "5.169.0",
|
|
6
|
+
"tag": "@microsoft/rush_v5.169.0",
|
|
7
|
+
"date": "Thu, 19 Feb 2026 00:05:11 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Sort the `additionalFilesForOperation` property in operation settings entries in projects' `config/rush-project.json` files before computing operation hashes to produce a stable hash for caching."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"comment": "Normalize package layout. CommonJS is now under `lib-commonjs` and DTS is now under `lib-dts`. Imports to `lib` still work as before, handled by the `\"exports\"` field in `package.json`."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Add a new \"omitAppleDoubleFilesFromBuildCache\" experiment. When enabled, the Rush build cache will omit macOS AppleDouble metadata files (._*) from cache archives when a companion file exists in the same directory. This prevents platform-specific metadata files from polluting the shared build cache. The exclusion only applies when running on macOS."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"comment": "Add a new `dependsOnNodeVersion` setting for operation entries in rush-project.json. When enabled, the Node.js version is included in the build cache hash, ensuring that cached outputs are invalidated when the Node.js version changes. Accepts `true` (alias for `\"patch\"`), `\"major\"`, `\"minor\"`, or `\"patch\"` to control the granularity of version matching."
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
4
25
|
{
|
|
5
26
|
"version": "5.168.0",
|
|
6
27
|
"tag": "@microsoft/rush_v5.168.0",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Change Log - @microsoft/rush
|
|
2
2
|
|
|
3
|
-
This log was last generated on Thu,
|
|
3
|
+
This log was last generated on Thu, 19 Feb 2026 00:05:11 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.169.0
|
|
6
|
+
Thu, 19 Feb 2026 00:05:11 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Sort the `additionalFilesForOperation` property in operation settings entries in projects' `config/rush-project.json` files before computing operation hashes to produce a stable hash for caching.
|
|
11
|
+
- Normalize package layout. CommonJS is now under `lib-commonjs` and DTS is now under `lib-dts`. Imports to `lib` still work as before, handled by the `"exports"` field in `package.json`.
|
|
12
|
+
- Add a new "omitAppleDoubleFilesFromBuildCache" experiment. When enabled, the Rush build cache will omit macOS AppleDouble metadata files (._*) from cache archives when a companion file exists in the same directory. This prevents platform-specific metadata files from polluting the shared build cache. The exclusion only applies when running on macOS.
|
|
13
|
+
- Add a new `dependsOnNodeVersion` setting for operation entries in rush-project.json. When enabled, the Node.js version is included in the build cache hash, ensuring that cached outputs are invalidated when the Node.js version changes. Accepts `true` (alias for `"patch"`), `"major"`, `"minor"`, or `"patch"` to control the granularity of version matching.
|
|
4
14
|
|
|
5
15
|
## 5.168.0
|
|
6
16
|
Thu, 12 Feb 2026 23:01:10 GMT
|
package/bin/rush
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js');
|
|
2
|
+
require('../lib-commonjs/start.js');
|
package/bin/rush-pnpm
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js');
|
|
2
|
+
require('../lib-commonjs/start.js');
|
package/bin/rushx
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js');
|
|
2
|
+
require('../lib-commonjs/start.js');
|
|
@@ -52,10 +52,8 @@ class RushCommandSelector {
|
|
|
52
52
|
RushCommandSelector._failWithError(`This repository is using Rush version ${version} which does not support the ${commandName} command`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
static execute(launcherVersion,
|
|
56
|
-
|
|
57
|
-
selectedRushLib, options) {
|
|
58
|
-
const Rush = selectedRushLib.Rush;
|
|
55
|
+
static execute(launcherVersion, selectedRushLib, options) {
|
|
56
|
+
const { Rush } = selectedRushLib;
|
|
59
57
|
if (!Rush) {
|
|
60
58
|
// This should be impossible unless we somehow loaded an unexpected version
|
|
61
59
|
RushCommandSelector._failWithError(`Unable to find the "Rush" entry point in @microsoft/rush-lib`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RushCommandSelector.js","sourceRoot":"","sources":["../src/RushCommandSelector.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAkC;AAGlC,kDAA+C;AAI/C;;;;;;GAMG;AACH,MAAa,mBAAmB;IACvB,MAAM,CAAC,sBAAsB,CAAC,OAAe;QAClD,MAAM,WAAW,GAAgB,mBAAmB,CAAC,eAAe,EAAE,CAAC;QACvE,IAAI,WAAW,KAAK,MAAM,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YACxD,mBAAmB,CAAC,cAAc,CAChC,yCAAyC,OAAO,+BAA+B,WAAW,UAAU,CACrG,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,OAAO,CACnB,eAAuB,EACvB,eAAqD,EACrD,OAAuB;QAEvB,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QAEjC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,2EAA2E;YAC3E,mBAAmB,CAAC,cAAc,CAAC,8DAA8D,CAAC,CAAC;QACrG,CAAC;QAED,MAAM,WAAW,GAAgB,mBAAmB,CAAC,eAAe,EAAE,CAAC;QAEvE,IAAI,WAAW,KAAK,WAAW,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBACzB,mBAAmB,CAAC,cAAc,CAChC,yCAAyC,IAAI,CAAC,OAAO,EAAE;oBACrD,iDAAiD,CACpD,CAAC;YACJ,CAAC;YACD,IAAI,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kDAuEC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport type { ILaunchOptions } from '@microsoft/rush-lib/lib/index';\nimport { Colorize } from '@rushstack/terminal';\n\ntype CommandName = 'rush' | 'rush-pnpm' | 'rushx' | undefined;\n\n/**\n * Both \"rush\" and \"rushx\" share the same src/start.ts entry point. This makes it\n * a little easier for them to share all the same startup checks and version selector\n * logic. RushCommandSelector looks at argv to determine whether we're doing \"rush\"\n * or \"rushx\" behavior, and then invokes the appropriate entry point in the selected\n * @microsoft/rush-lib.\n */\nexport class RushCommandSelector {\n public static failIfNotInvokedAsRush(version: string): void {\n const commandName: CommandName = RushCommandSelector._getCommandName();\n if (commandName !== 'rush' && commandName !== undefined) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${version} which does not support the ${commandName} command`\n );\n }\n }\n\n public static execute(\n launcherVersion: string,\n selectedRushLib: typeof import('@microsoft/rush-lib'),\n options: ILaunchOptions\n ): void {\n const { Rush } = selectedRushLib;\n\n if (!Rush) {\n // This should be impossible unless we somehow loaded an unexpected version\n RushCommandSelector._failWithError(`Unable to find the \"Rush\" entry point in @microsoft/rush-lib`);\n }\n\n const commandName: CommandName = RushCommandSelector._getCommandName();\n\n if (commandName === 'rush-pnpm') {\n if (!Rush.launchRushPnpm) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${Rush.version}` +\n ` which does not support the \"rush-pnpm\" command`\n );\n }\n Rush.launchRushPnpm(launcherVersion, {\n isManaged: options.isManaged,\n alreadyReportedNodeTooNewError: options.alreadyReportedNodeTooNewError\n });\n } else if (commandName === 'rushx') {\n if (!Rush.launchRushX) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${Rush.version}` +\n ` which does not support the \"rushx\" command`\n );\n }\n Rush.launchRushX(launcherVersion, options);\n } else {\n Rush.launch(launcherVersion, options);\n }\n }\n\n private static _failWithError(message: string): never {\n console.log(Colorize.red(message));\n return process.exit(1);\n }\n\n private static _getCommandName(): CommandName {\n if (process.argv.length >= 2) {\n // Example:\n // argv[0]: \"C:\\\\Program Files\\\\nodejs\\\\node.exe\"\n // argv[1]: \"C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\@microsoft\\\\rush\\\\bin\\\\rushx\"\n const basename: string = path.basename(process.argv[1]).toUpperCase();\n if (basename === 'RUSH') {\n return 'rush';\n }\n if (basename === 'RUSH-PNPM') {\n return 'rush-pnpm';\n }\n if (basename === 'RUSHX') {\n return 'rushx';\n }\n }\n return undefined;\n }\n}\n"]}
|
|
@@ -60,7 +60,7 @@ class RushVersionSelector {
|
|
|
60
60
|
console.log(`Rush version ${version} is not currently installed. Installing...`);
|
|
61
61
|
const resourceName = `rush-${version}`;
|
|
62
62
|
console.log(`Trying to acquire lock for ${resourceName}`);
|
|
63
|
-
const lock = await node_core_library_1.LockFile.
|
|
63
|
+
const lock = await node_core_library_1.LockFile.acquireAsync(expectedRushPath, resourceName);
|
|
64
64
|
installIsValid = await installMarker.isValidAsync();
|
|
65
65
|
if (installIsValid) {
|
|
66
66
|
console.log('Another process performed the installation.');
|
|
@@ -100,8 +100,15 @@ class RushVersionSelector {
|
|
|
100
100
|
require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'start'));
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
+
// Explicitly resolve the entry point for rush-lib, rather than using a simple require, because
|
|
104
|
+
// newer versions of rush-lib use the package.json `exports` field, which maps
|
|
105
|
+
// `lib/index` to `lib-commonjs/index.js`
|
|
106
|
+
const rushLibEntrypoint = await node_core_library_1.Import.resolveModuleAsync({
|
|
107
|
+
modulePath: '@microsoft/rush-lib/lib/index',
|
|
108
|
+
baseFolderPath: expectedRushPath
|
|
109
|
+
});
|
|
110
|
+
const rushCliEntrypoint = require(rushLibEntrypoint);
|
|
103
111
|
// For newer rush-lib, RushCommandSelector can test whether "rushx" is supported or not
|
|
104
|
-
const rushCliEntrypoint = require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush-lib', 'lib', 'index'));
|
|
105
112
|
RushCommandSelector_1.RushCommandSelector.execute(this._currentPackageVersion, rushCliEntrypoint, executeOptions);
|
|
106
113
|
}
|
|
107
114
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RushVersionSelector.js","sourceRoot":"","sources":["../src/RushVersionSelector.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAkC;AAElC,+CAAiC;AAEjC,oEAAgE;AAChE,2EAAwE;AACxE,kDAAwF;AAExF,+DAA4D;AAG5D,MAAM,oBAAoB,GAAW,CAAC,CAAC;AAEvC,MAAa,mBAAmB;IAI9B,YAAmB,qBAA6B;QAC9C,IAAI,CAAC,iBAAiB,GAAG,IAAI,4BAAiB,EAAE,CAAC;QACjD,IAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,+BAA+B,CAC1C,OAAe,EACf,aAAmD,EACnD,cAA8B;QAE9B,MAAM,mBAAmB,GAAY,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAW,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,QAAQ,OAAO,EAAE,CAAC,CAAC;QAEvG,MAAM,aAAa,GAAc,IAAI,oBAAS,CAAC,gBAAgB,EAAE,cAAc,EAAE;YAC/E,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;SAC5B,CAAC,CAAC;QAEH,IAAI,cAAc,GAAY,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC;QACjE,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,uBAAuB;YACvB,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,4CAA4C,CAAC,CAAC;YAEjF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,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;QAC5F,CAAC;aAAM,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;YACvC,0FAA0F;YAC1F,6CAA6C;YAC7C,yCAAmB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YACpD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7F,CAAC;aAAM,CAAC;YACN,+FAA+F;YAC/F,8EAA8E;YAC9E,yCAAyC;YACzC,MAAM,iBAAiB,GAAW,MAAM,0BAAM,CAAC,kBAAkB,CAAC;gBAChE,UAAU,EAAE,+BAA+B;gBAC3C,cAAc,EAAE,gBAAgB;aACjC,CAAC,CAAC;YACH,MAAM,iBAAiB,GAAyC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC3F,uFAAuF;YACvF,yCAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;CACF;AAnFD,kDAmFC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport * as semver from 'semver';\n\nimport { LockFile, Import } from '@rushstack/node-core-library';\nimport { Utilities } from '@microsoft/rush-lib/lib/utilities/Utilities';\nimport { _FlagFile, _RushGlobalFolder, type ILaunchOptions } from '@microsoft/rush-lib';\n\nimport { RushCommandSelector } from './RushCommandSelector';\nimport type { MinimalRushConfiguration } from './MinimalRushConfiguration';\n\nconst MAX_INSTALL_ATTEMPTS: number = 3;\n\nexport class RushVersionSelector {\n private _rushGlobalFolder: _RushGlobalFolder;\n private _currentPackageVersion: string;\n\n public constructor(currentPackageVersion: string) {\n this._rushGlobalFolder = new _RushGlobalFolder();\n this._currentPackageVersion = currentPackageVersion;\n }\n\n public async ensureRushVersionInstalledAsync(\n version: string,\n configuration: MinimalRushConfiguration | undefined,\n executeOptions: ILaunchOptions\n ): Promise<void> {\n const isLegacyRushVersion: boolean = semver.lt(version, '4.0.0');\n const expectedRushPath: string = path.join(this._rushGlobalFolder.nodeSpecificPath, `rush-${version}`);\n\n const installMarker: _FlagFile = new _FlagFile(expectedRushPath, 'last-install', {\n node: process.versions.node\n });\n\n let installIsValid: boolean = await installMarker.isValidAsync();\n if (!installIsValid) {\n // Need to install Rush\n console.log(`Rush version ${version} is not currently installed. Installing...`);\n\n const resourceName: string = `rush-${version}`;\n\n console.log(`Trying to acquire lock for ${resourceName}`);\n\n const lock: LockFile = await LockFile.acquireAsync(expectedRushPath, resourceName);\n installIsValid = await installMarker.isValidAsync();\n if (installIsValid) {\n console.log('Another process performed the installation.');\n } else {\n await Utilities.installPackageInDirectoryAsync({\n directory: expectedRushPath,\n packageName: isLegacyRushVersion ? '@microsoft/rush' : '@microsoft/rush-lib',\n version: version,\n tempPackageTitle: 'rush-local-install',\n maxInstallAttempts: MAX_INSTALL_ATTEMPTS,\n // This is using a local configuration to install a package in a shared global location.\n // Generally that's a bad practice, but in this case if we can successfully install\n // the package at all, we can reasonably assume it's good for all the repositories.\n // In particular, we'll assume that two different NPM registries cannot have two\n // different implementations of the same version of the same package.\n // This was needed for: https://github.com/microsoft/rushstack/issues/691\n commonRushConfigFolder: configuration ? configuration.commonRushConfigFolder : undefined,\n suppressOutput: true\n });\n\n console.log(`Successfully installed Rush version ${version} in ${expectedRushPath}.`);\n\n // If we've made it here without exception, write the flag file\n await installMarker.createAsync();\n\n lock.release();\n }\n }\n\n if (semver.lt(version, '3.0.20')) {\n // In old versions, requiring the entry point invoked the command-line parser immediately,\n // so fail if \"rushx\" or \"rush-pnpm\" was used\n RushCommandSelector.failIfNotInvokedAsRush(version);\n require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'rush'));\n } else if (semver.lt(version, '4.0.0')) {\n // In old versions, requiring the entry point invoked the command-line parser immediately,\n // so fail if \"rushx\" or \"rush-pnpm\" was used\n RushCommandSelector.failIfNotInvokedAsRush(version);\n require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'start'));\n } else {\n // Explicitly resolve the entry point for rush-lib, rather than using a simple require, because\n // newer versions of rush-lib use the package.json `exports` field, which maps\n // `lib/index` to `lib-commonjs/index.js`\n const rushLibEntrypoint: string = await Import.resolveModuleAsync({\n modulePath: '@microsoft/rush-lib/lib/index',\n baseFolderPath: expectedRushPath\n });\n const rushCliEntrypoint: typeof import('@microsoft/rush-lib') = require(rushLibEntrypoint);\n // For newer rush-lib, RushCommandSelector can test whether \"rushx\" is supported or not\n RushCommandSelector.execute(this._currentPackageVersion, rushCliEntrypoint, executeOptions);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+FAA+F;AAC/F,gGAAgG;AAChG,yFAAyF;AACzF,oCAAoC;AACpC,wCAAwC;AACxC,2FAAwF;AAExF,IAAI,yCAAmB,CAAC,gCAAgC,EAAE,EAAE,CAAC;IAC3D,+FAA+F;IAC/F,kFAAkF;IAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,8BAA8B,GAAY,yCAAmB,CAAC,sBAAsB,CAAC;IACzF,SAAS,EAAE,KAAK;IAChB,8BAA8B,EAAE,KAAK;CACtC,CAAC,CAAC;AAEH,4CAA8B;AAE9B,+CAAiC;AAEjC,oEAAuE;AACvE,kDAAgG;AAChG,kDAA+D;
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"m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AAe;SACZ,+BAA+B,CAAC,iBAAiB,EAAE,aAAa,EAAE,aAAa,CAAC;SAChF,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;QACtB,OAAO,CAAC,GAAG,CAAC,mBAAQ,CAAC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACP,CAAC;KAAM,CAAC;IACN,iEAAiE;IACjE,yCAAmB,CAAC,OAAO,CAAC,qBAAqB,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// We're using a path-based import here to minimize the amount of code that is evaluated before\n// we check to see if the Node.js version is too old. If, for whatever reason, Rush crashes with\n// an old Node.js version when evaluating one of the more complex imports, we'll at least\n// shown a meaningful error message.\n// eslint-disable-next-line import/order\nimport { NodeJsCompatibility } from '@microsoft/rush-lib/lib/logic/NodeJsCompatibility';\n\nif (NodeJsCompatibility.reportAncientIncompatibleVersion()) {\n // The Node.js version is known to have serious incompatibilities. In that situation, the user\n // should downgrade Rush to an older release that supported their Node.js version.\n process.exit(1);\n}\n\nconst alreadyReportedNodeTooNewError: boolean = NodeJsCompatibility.warnAboutVersionTooNew({\n isRushLib: false,\n alreadyReportedNodeTooNewError: false\n});\n\nimport * as os from 'node:os';\n\nimport * as semver from 'semver';\n\nimport { Text, PackageJsonLookup } from '@rushstack/node-core-library';\nimport { Colorize, ConsoleTerminalProvider, type ITerminalProvider } from '@rushstack/terminal';\nimport { EnvironmentVariableNames } from '@microsoft/rush-lib';\nimport type { ILaunchOptions } from '@microsoft/rush-lib';\nimport * as rushLib from '@microsoft/rush-lib';\n\nimport { RushCommandSelector } from './RushCommandSelector';\nimport { RushVersionSelector } from './RushVersionSelector';\nimport { MinimalRushConfiguration } from './MinimalRushConfiguration';\n\n// Load the configuration\nconst configuration: MinimalRushConfiguration | undefined =\n MinimalRushConfiguration.loadFromDefaultLocation();\n\nconst currentPackageVersion: string = PackageJsonLookup.loadOwnPackageJson(__dirname).version;\n\nlet rushVersionToLoad: string | undefined = undefined;\n\nconst previewVersion: string | undefined = process.env[EnvironmentVariableNames.RUSH_PREVIEW_VERSION];\n\nif (previewVersion) {\n if (!semver.valid(previewVersion, false)) {\n console.error(\n Colorize.red(`Invalid value for RUSH_PREVIEW_VERSION environment variable: \"${previewVersion}\"`)\n );\n process.exit(1);\n }\n\n rushVersionToLoad = previewVersion;\n\n const lines: string[] = [];\n lines.push(\n `*********************************************************************`,\n `* WARNING! THE \"RUSH_PREVIEW_VERSION\" ENVIRONMENT VARIABLE IS SET. *`,\n `* *`,\n `* You are previewing Rush version: ${Text.padEnd(previewVersion, 25)} *`\n );\n\n if (configuration) {\n lines.push(`* The rush.json configuration asks for: ${Text.padEnd(configuration.rushVersion, 25)} *`);\n }\n\n lines.push(\n `* *`,\n `* To restore the normal behavior, unset the RUSH_PREVIEW_VERSION *`,\n `* environment variable. *`,\n `*********************************************************************`\n );\n\n console.error(lines.map((line) => Colorize.black(Colorize.yellowBackground(line))).join(os.EOL));\n} else if (configuration) {\n rushVersionToLoad = configuration.rushVersion;\n}\n\n// If we are previewing an older Rush that doesn't understand the RUSH_PREVIEW_VERSION variable,\n// then unset it.\nif (rushVersionToLoad && semver.lt(rushVersionToLoad, '5.0.0-dev.18')) {\n delete process.env[EnvironmentVariableNames.RUSH_PREVIEW_VERSION];\n}\n\n// Rush is \"managed\" if its version and configuration are dictated by a repo's rush.json\nconst isManaged: boolean = !!configuration;\n\nconst terminalProvider: ITerminalProvider = new ConsoleTerminalProvider();\n\nconst launchOptions: ILaunchOptions = { isManaged, alreadyReportedNodeTooNewError, terminalProvider };\n\n// If we're inside a repo folder, and it's requesting a different version, then use the RushVersionManager to\n// install it\nif (rushVersionToLoad && rushVersionToLoad !== currentPackageVersion) {\n const versionSelector: RushVersionSelector = new RushVersionSelector(currentPackageVersion);\n versionSelector\n .ensureRushVersionInstalledAsync(rushVersionToLoad, configuration, launchOptions)\n .catch((error: Error) => {\n console.log(Colorize.red('Error: ' + error.message));\n });\n} else {\n // Otherwise invoke the rush-lib that came with this rush package\n RushCommandSelector.execute(currentPackageVersion, rushLib, launchOptions);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ILaunchOptions } from '@microsoft/rush-lib/lib/index';
|
|
2
2
|
/**
|
|
3
3
|
* Both "rush" and "rushx" share the same src/start.ts entry point. This makes it
|
|
4
4
|
* a little easier for them to share all the same startup checks and version selector
|
|
@@ -8,7 +8,7 @@ import type * as rushLib from '@microsoft/rush-lib';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class RushCommandSelector {
|
|
10
10
|
static failIfNotInvokedAsRush(version: string): void;
|
|
11
|
-
static execute(launcherVersion: string, selectedRushLib:
|
|
11
|
+
static execute(launcherVersion: string, selectedRushLib: typeof import('@microsoft/rush-lib'), options: ILaunchOptions): void;
|
|
12
12
|
private static _failWithError;
|
|
13
13
|
private static _getCommandName;
|
|
14
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RushCommandSelector.d.ts","sourceRoot":"","sources":["../src/RushCommandSelector.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAKpE;;;;;;GAMG;AACH,qBAAa,mBAAmB;WAChB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;WAS7C,OAAO,CACnB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,cAAc,qBAAqB,CAAC,EACrD,OAAO,EAAE,cAAc,GACtB,IAAI;IAkCP,OAAO,CAAC,MAAM,CAAC,cAAc;IAK7B,OAAO,CAAC,MAAM,CAAC,eAAe;CAkB/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RushVersionSelector.d.ts","sourceRoot":"","sources":["../src/RushVersionSelector.ts"],"names":[],"mappings":"AASA,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGxF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAI3E,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,sBAAsB,CAAS;gBAEpB,qBAAqB,EAAE,MAAM;IAKnC,+BAA+B,CAC1C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,wBAAwB,GAAG,SAAS,EACnD,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"RushVersionSelector.d.ts","sourceRoot":"","sources":["../src/RushVersionSelector.ts"],"names":[],"mappings":"AASA,OAAO,EAAgC,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGxF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAI3E,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,sBAAsB,CAAS;gBAEpB,qBAAqB,EAAE,MAAM;IAKnC,+BAA+B,CAC1C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,wBAAwB,GAAG,SAAS,EACnD,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,IAAI,CAAC;CAsEjB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { JsonFile } from '@rushstack/node-core-library';
|
|
5
|
+
import { RushConfiguration } from '@microsoft/rush-lib';
|
|
6
|
+
import { RushConstants } from '@microsoft/rush-lib/lib/logic/RushConstants';
|
|
7
|
+
import { RushCommandLineParser } from '@microsoft/rush-lib/lib/cli/RushCommandLineParser';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a minimal subset of the rush.json configuration file. It provides the information necessary to
|
|
10
|
+
* decide which version of Rush should be installed/used.
|
|
11
|
+
*/
|
|
12
|
+
export class MinimalRushConfiguration {
|
|
13
|
+
constructor(minimalRushConfigurationJson, rushJsonFilename) {
|
|
14
|
+
this._rushVersion =
|
|
15
|
+
minimalRushConfigurationJson.rushVersion || minimalRushConfigurationJson.rushMinimumVersion;
|
|
16
|
+
this._commonRushConfigFolder = path.join(path.dirname(rushJsonFilename), RushConstants.commonFolderName, 'config', 'rush');
|
|
17
|
+
}
|
|
18
|
+
static loadFromDefaultLocation() {
|
|
19
|
+
const rushJsonLocation = RushConfiguration.tryFindRushJsonLocation({
|
|
20
|
+
showVerbose: !RushCommandLineParser.shouldRestrictConsoleOutput()
|
|
21
|
+
});
|
|
22
|
+
if (rushJsonLocation) {
|
|
23
|
+
return MinimalRushConfiguration._loadFromConfigurationFile(rushJsonLocation);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
static _loadFromConfigurationFile(rushJsonFilename) {
|
|
30
|
+
try {
|
|
31
|
+
const minimalRushConfigurationJson = JsonFile.load(rushJsonFilename);
|
|
32
|
+
return new MinimalRushConfiguration(minimalRushConfigurationJson, rushJsonFilename);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The version of rush specified by the rushVersion property of the rush.json configuration file. If the
|
|
40
|
+
* rushVersion property is not specified, this falls back to the rushMinimumVersion property. This should be
|
|
41
|
+
* a semver style version number like "4.0.0"
|
|
42
|
+
*/
|
|
43
|
+
get rushVersion() {
|
|
44
|
+
return this._rushVersion;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The folder where Rush's additional config files are stored. This folder is always a
|
|
48
|
+
* subfolder called "config\rush" inside the common folder. (The "common\config" folder
|
|
49
|
+
* is reserved for configuration files used by other tools.) To avoid confusion or mistakes,
|
|
50
|
+
* Rush will report an error if this this folder contains any unrecognized files.
|
|
51
|
+
*
|
|
52
|
+
* Example: "C:\MyRepo\common\config\rush"
|
|
53
|
+
*/
|
|
54
|
+
get commonRushConfigFolder() {
|
|
55
|
+
return this._commonRushConfigFolder;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=MinimalRushConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinimalRushConfiguration.js","sourceRoot":"","sources":["../src/MinimalRushConfiguration.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAO1F;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAInC,YAAoB,4BAA2D,EAAE,gBAAwB;QACvG,IAAI,CAAC,YAAY;YACf,4BAA4B,CAAC,WAAW,IAAI,4BAA4B,CAAC,kBAAkB,CAAC;QAC9F,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,IAAI,CACtC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC9B,aAAa,CAAC,gBAAgB,EAC9B,QAAQ,EACR,MAAM,CACP,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,uBAAuB;QACnC,MAAM,gBAAgB,GAAuB,iBAAiB,CAAC,uBAAuB,CAAC;YACrF,WAAW,EAAE,CAAC,qBAAqB,CAAC,2BAA2B,EAAE;SAClE,CAAC,CAAC;QACH,IAAI,gBAAgB,EAAE,CAAC;YACrB,OAAO,wBAAwB,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;QAC/E,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,0BAA0B,CAAC,gBAAwB;QAChE,IAAI,CAAC;YACH,MAAM,4BAA4B,GAAkC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACpG,OAAO,IAAI,wBAAwB,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;QACtF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACH,IAAW,sBAAsB;QAC/B,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport { JsonFile } from '@rushstack/node-core-library';\nimport { RushConfiguration } from '@microsoft/rush-lib';\nimport { RushConstants } from '@microsoft/rush-lib/lib/logic/RushConstants';\nimport { RushCommandLineParser } from '@microsoft/rush-lib/lib/cli/RushCommandLineParser';\n\ninterface IMinimalRushConfigurationJson {\n rushMinimumVersion: string;\n rushVersion?: string;\n}\n\n/**\n * Represents a minimal subset of the rush.json configuration file. It provides the information necessary to\n * decide which version of Rush should be installed/used.\n */\nexport class MinimalRushConfiguration {\n private _rushVersion: string;\n private _commonRushConfigFolder: string;\n\n private constructor(minimalRushConfigurationJson: IMinimalRushConfigurationJson, rushJsonFilename: string) {\n this._rushVersion =\n minimalRushConfigurationJson.rushVersion || minimalRushConfigurationJson.rushMinimumVersion;\n this._commonRushConfigFolder = path.join(\n path.dirname(rushJsonFilename),\n RushConstants.commonFolderName,\n 'config',\n 'rush'\n );\n }\n\n public static loadFromDefaultLocation(): MinimalRushConfiguration | undefined {\n const rushJsonLocation: string | undefined = RushConfiguration.tryFindRushJsonLocation({\n showVerbose: !RushCommandLineParser.shouldRestrictConsoleOutput()\n });\n if (rushJsonLocation) {\n return MinimalRushConfiguration._loadFromConfigurationFile(rushJsonLocation);\n } else {\n return undefined;\n }\n }\n\n private static _loadFromConfigurationFile(rushJsonFilename: string): MinimalRushConfiguration | undefined {\n try {\n const minimalRushConfigurationJson: IMinimalRushConfigurationJson = JsonFile.load(rushJsonFilename);\n return new MinimalRushConfiguration(minimalRushConfigurationJson, rushJsonFilename);\n } catch (e) {\n return undefined;\n }\n }\n\n /**\n * The version of rush specified by the rushVersion property of the rush.json configuration file. If the\n * rushVersion property is not specified, this falls back to the rushMinimumVersion property. This should be\n * a semver style version number like \"4.0.0\"\n */\n public get rushVersion(): string {\n return this._rushVersion;\n }\n\n /**\n * The folder where Rush's additional config files are stored. This folder is always a\n * subfolder called \"config\\rush\" inside the common folder. (The \"common\\config\" folder\n * is reserved for configuration files used by other tools.) To avoid confusion or mistakes,\n * Rush will report an error if this this folder contains any unrecognized files.\n *\n * Example: \"C:\\MyRepo\\common\\config\\rush\"\n */\n public get commonRushConfigFolder(): string {\n return this._commonRushConfigFolder;\n }\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { Colorize } from '@rushstack/terminal';
|
|
5
|
+
/**
|
|
6
|
+
* Both "rush" and "rushx" share the same src/start.ts entry point. This makes it
|
|
7
|
+
* a little easier for them to share all the same startup checks and version selector
|
|
8
|
+
* logic. RushCommandSelector looks at argv to determine whether we're doing "rush"
|
|
9
|
+
* or "rushx" behavior, and then invokes the appropriate entry point in the selected
|
|
10
|
+
* @microsoft/rush-lib.
|
|
11
|
+
*/
|
|
12
|
+
export class RushCommandSelector {
|
|
13
|
+
static failIfNotInvokedAsRush(version) {
|
|
14
|
+
const commandName = RushCommandSelector._getCommandName();
|
|
15
|
+
if (commandName !== 'rush' && commandName !== undefined) {
|
|
16
|
+
RushCommandSelector._failWithError(`This repository is using Rush version ${version} which does not support the ${commandName} command`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
static execute(launcherVersion, selectedRushLib, options) {
|
|
20
|
+
const { Rush } = selectedRushLib;
|
|
21
|
+
if (!Rush) {
|
|
22
|
+
// This should be impossible unless we somehow loaded an unexpected version
|
|
23
|
+
RushCommandSelector._failWithError(`Unable to find the "Rush" entry point in @microsoft/rush-lib`);
|
|
24
|
+
}
|
|
25
|
+
const commandName = RushCommandSelector._getCommandName();
|
|
26
|
+
if (commandName === 'rush-pnpm') {
|
|
27
|
+
if (!Rush.launchRushPnpm) {
|
|
28
|
+
RushCommandSelector._failWithError(`This repository is using Rush version ${Rush.version}` +
|
|
29
|
+
` which does not support the "rush-pnpm" command`);
|
|
30
|
+
}
|
|
31
|
+
Rush.launchRushPnpm(launcherVersion, {
|
|
32
|
+
isManaged: options.isManaged,
|
|
33
|
+
alreadyReportedNodeTooNewError: options.alreadyReportedNodeTooNewError
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else if (commandName === 'rushx') {
|
|
37
|
+
if (!Rush.launchRushX) {
|
|
38
|
+
RushCommandSelector._failWithError(`This repository is using Rush version ${Rush.version}` +
|
|
39
|
+
` which does not support the "rushx" command`);
|
|
40
|
+
}
|
|
41
|
+
Rush.launchRushX(launcherVersion, options);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
Rush.launch(launcherVersion, options);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static _failWithError(message) {
|
|
48
|
+
console.log(Colorize.red(message));
|
|
49
|
+
return process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
static _getCommandName() {
|
|
52
|
+
if (process.argv.length >= 2) {
|
|
53
|
+
// Example:
|
|
54
|
+
// argv[0]: "C:\\Program Files\\nodejs\\node.exe"
|
|
55
|
+
// argv[1]: "C:\\Program Files\\nodejs\\node_modules\\@microsoft\\rush\\bin\\rushx"
|
|
56
|
+
const basename = path.basename(process.argv[1]).toUpperCase();
|
|
57
|
+
if (basename === 'RUSH') {
|
|
58
|
+
return 'rush';
|
|
59
|
+
}
|
|
60
|
+
if (basename === 'RUSH-PNPM') {
|
|
61
|
+
return 'rush-pnpm';
|
|
62
|
+
}
|
|
63
|
+
if (basename === 'RUSHX') {
|
|
64
|
+
return 'rushx';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=RushCommandSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RushCommandSelector.js","sourceRoot":"","sources":["../src/RushCommandSelector.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI/C;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IACvB,MAAM,CAAC,sBAAsB,CAAC,OAAe;QAClD,MAAM,WAAW,GAAgB,mBAAmB,CAAC,eAAe,EAAE,CAAC;QACvE,IAAI,WAAW,KAAK,MAAM,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YACxD,mBAAmB,CAAC,cAAc,CAChC,yCAAyC,OAAO,+BAA+B,WAAW,UAAU,CACrG,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,OAAO,CACnB,eAAuB,EACvB,eAAqD,EACrD,OAAuB;QAEvB,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QAEjC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,2EAA2E;YAC3E,mBAAmB,CAAC,cAAc,CAAC,8DAA8D,CAAC,CAAC;QACrG,CAAC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AAE,CAAC;gBACxB,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;gBAC7B,OAAO,WAAW,CAAC;YACrB,CAAC;YACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACzB,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport type { ILaunchOptions } from '@microsoft/rush-lib/lib/index';\nimport { Colorize } from '@rushstack/terminal';\n\ntype CommandName = 'rush' | 'rush-pnpm' | 'rushx' | undefined;\n\n/**\n * Both \"rush\" and \"rushx\" share the same src/start.ts entry point. This makes it\n * a little easier for them to share all the same startup checks and version selector\n * logic. RushCommandSelector looks at argv to determine whether we're doing \"rush\"\n * or \"rushx\" behavior, and then invokes the appropriate entry point in the selected\n * @microsoft/rush-lib.\n */\nexport class RushCommandSelector {\n public static failIfNotInvokedAsRush(version: string): void {\n const commandName: CommandName = RushCommandSelector._getCommandName();\n if (commandName !== 'rush' && commandName !== undefined) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${version} which does not support the ${commandName} command`\n );\n }\n }\n\n public static execute(\n launcherVersion: string,\n selectedRushLib: typeof import('@microsoft/rush-lib'),\n options: ILaunchOptions\n ): void {\n const { Rush } = selectedRushLib;\n\n if (!Rush) {\n // This should be impossible unless we somehow loaded an unexpected version\n RushCommandSelector._failWithError(`Unable to find the \"Rush\" entry point in @microsoft/rush-lib`);\n }\n\n const commandName: CommandName = RushCommandSelector._getCommandName();\n\n if (commandName === 'rush-pnpm') {\n if (!Rush.launchRushPnpm) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${Rush.version}` +\n ` which does not support the \"rush-pnpm\" command`\n );\n }\n Rush.launchRushPnpm(launcherVersion, {\n isManaged: options.isManaged,\n alreadyReportedNodeTooNewError: options.alreadyReportedNodeTooNewError\n });\n } else if (commandName === 'rushx') {\n if (!Rush.launchRushX) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${Rush.version}` +\n ` which does not support the \"rushx\" command`\n );\n }\n Rush.launchRushX(launcherVersion, options);\n } else {\n Rush.launch(launcherVersion, options);\n }\n }\n\n private static _failWithError(message: string): never {\n console.log(Colorize.red(message));\n return process.exit(1);\n }\n\n private static _getCommandName(): CommandName {\n if (process.argv.length >= 2) {\n // Example:\n // argv[0]: \"C:\\\\Program Files\\\\nodejs\\\\node.exe\"\n // argv[1]: \"C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\@microsoft\\\\rush\\\\bin\\\\rushx\"\n const basename: string = path.basename(process.argv[1]).toUpperCase();\n if (basename === 'RUSH') {\n return 'rush';\n }\n if (basename === 'RUSH-PNPM') {\n return 'rush-pnpm';\n }\n if (basename === 'RUSHX') {\n return 'rushx';\n }\n }\n return undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import * as semver from 'semver';
|
|
5
|
+
import { LockFile, Import } from '@rushstack/node-core-library';
|
|
6
|
+
import { Utilities } from '@microsoft/rush-lib/lib/utilities/Utilities';
|
|
7
|
+
import { _FlagFile, _RushGlobalFolder } from '@microsoft/rush-lib';
|
|
8
|
+
import { RushCommandSelector } from './RushCommandSelector';
|
|
9
|
+
const MAX_INSTALL_ATTEMPTS = 3;
|
|
10
|
+
export class RushVersionSelector {
|
|
11
|
+
constructor(currentPackageVersion) {
|
|
12
|
+
this._rushGlobalFolder = new _RushGlobalFolder();
|
|
13
|
+
this._currentPackageVersion = currentPackageVersion;
|
|
14
|
+
}
|
|
15
|
+
async ensureRushVersionInstalledAsync(version, configuration, executeOptions) {
|
|
16
|
+
const isLegacyRushVersion = semver.lt(version, '4.0.0');
|
|
17
|
+
const expectedRushPath = path.join(this._rushGlobalFolder.nodeSpecificPath, `rush-${version}`);
|
|
18
|
+
const installMarker = new _FlagFile(expectedRushPath, 'last-install', {
|
|
19
|
+
node: process.versions.node
|
|
20
|
+
});
|
|
21
|
+
let installIsValid = await installMarker.isValidAsync();
|
|
22
|
+
if (!installIsValid) {
|
|
23
|
+
// Need to install Rush
|
|
24
|
+
console.log(`Rush version ${version} is not currently installed. Installing...`);
|
|
25
|
+
const resourceName = `rush-${version}`;
|
|
26
|
+
console.log(`Trying to acquire lock for ${resourceName}`);
|
|
27
|
+
const lock = await LockFile.acquireAsync(expectedRushPath, resourceName);
|
|
28
|
+
installIsValid = await installMarker.isValidAsync();
|
|
29
|
+
if (installIsValid) {
|
|
30
|
+
console.log('Another process performed the installation.');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
await Utilities.installPackageInDirectoryAsync({
|
|
34
|
+
directory: expectedRushPath,
|
|
35
|
+
packageName: isLegacyRushVersion ? '@microsoft/rush' : '@microsoft/rush-lib',
|
|
36
|
+
version: version,
|
|
37
|
+
tempPackageTitle: 'rush-local-install',
|
|
38
|
+
maxInstallAttempts: MAX_INSTALL_ATTEMPTS,
|
|
39
|
+
// This is using a local configuration to install a package in a shared global location.
|
|
40
|
+
// Generally that's a bad practice, but in this case if we can successfully install
|
|
41
|
+
// the package at all, we can reasonably assume it's good for all the repositories.
|
|
42
|
+
// In particular, we'll assume that two different NPM registries cannot have two
|
|
43
|
+
// different implementations of the same version of the same package.
|
|
44
|
+
// This was needed for: https://github.com/microsoft/rushstack/issues/691
|
|
45
|
+
commonRushConfigFolder: configuration ? configuration.commonRushConfigFolder : undefined,
|
|
46
|
+
suppressOutput: true
|
|
47
|
+
});
|
|
48
|
+
console.log(`Successfully installed Rush version ${version} in ${expectedRushPath}.`);
|
|
49
|
+
// If we've made it here without exception, write the flag file
|
|
50
|
+
await installMarker.createAsync();
|
|
51
|
+
lock.release();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (semver.lt(version, '3.0.20')) {
|
|
55
|
+
// In old versions, requiring the entry point invoked the command-line parser immediately,
|
|
56
|
+
// so fail if "rushx" or "rush-pnpm" was used
|
|
57
|
+
RushCommandSelector.failIfNotInvokedAsRush(version);
|
|
58
|
+
require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'rush'));
|
|
59
|
+
}
|
|
60
|
+
else if (semver.lt(version, '4.0.0')) {
|
|
61
|
+
// In old versions, requiring the entry point invoked the command-line parser immediately,
|
|
62
|
+
// so fail if "rushx" or "rush-pnpm" was used
|
|
63
|
+
RushCommandSelector.failIfNotInvokedAsRush(version);
|
|
64
|
+
require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'start'));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Explicitly resolve the entry point for rush-lib, rather than using a simple require, because
|
|
68
|
+
// newer versions of rush-lib use the package.json `exports` field, which maps
|
|
69
|
+
// `lib/index` to `lib-commonjs/index.js`
|
|
70
|
+
const rushLibEntrypoint = await Import.resolveModuleAsync({
|
|
71
|
+
modulePath: '@microsoft/rush-lib/lib/index',
|
|
72
|
+
baseFolderPath: expectedRushPath
|
|
73
|
+
});
|
|
74
|
+
const rushCliEntrypoint = require(rushLibEntrypoint);
|
|
75
|
+
// For newer rush-lib, RushCommandSelector can test whether "rushx" is supported or not
|
|
76
|
+
RushCommandSelector.execute(this._currentPackageVersion, rushCliEntrypoint, executeOptions);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=RushVersionSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RushVersionSelector.js","sourceRoot":"","sources":["../src/RushVersionSelector.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC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AC;YACvC,0FAA0F;YAC1F,6CAA6C;YAC7C,mBAAmB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;YACpD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7F,CAAC;aAAM,CAAC;YACN,+FAA+F;YAC/F,8EAA8E;YAC9E,yCAAyC;YACzC,MAAM,iBAAiB,GAAW,MAAM,MAAM,CAAC,kBAAkB,CAAC;gBAChE,UAAU,EAAE,+BAA+B;gBAC3C,cAAc,EAAE,gBAAgB;aACjC,CAAC,CAAC;YACH,MAAM,iBAAiB,GAAyC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC3F,uFAAuF;YACvF,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport * as semver from 'semver';\n\nimport { LockFile, Import } from '@rushstack/node-core-library';\nimport { Utilities } from '@microsoft/rush-lib/lib/utilities/Utilities';\nimport { _FlagFile, _RushGlobalFolder, type ILaunchOptions } from '@microsoft/rush-lib';\n\nimport { RushCommandSelector } from './RushCommandSelector';\nimport type { MinimalRushConfiguration } from './MinimalRushConfiguration';\n\nconst MAX_INSTALL_ATTEMPTS: number = 3;\n\nexport class RushVersionSelector {\n private _rushGlobalFolder: _RushGlobalFolder;\n private _currentPackageVersion: string;\n\n public constructor(currentPackageVersion: string) {\n this._rushGlobalFolder = new _RushGlobalFolder();\n this._currentPackageVersion = currentPackageVersion;\n }\n\n public async ensureRushVersionInstalledAsync(\n version: string,\n configuration: MinimalRushConfiguration | undefined,\n executeOptions: ILaunchOptions\n ): Promise<void> {\n const isLegacyRushVersion: boolean = semver.lt(version, '4.0.0');\n const expectedRushPath: string = path.join(this._rushGlobalFolder.nodeSpecificPath, `rush-${version}`);\n\n const installMarker: _FlagFile = new _FlagFile(expectedRushPath, 'last-install', {\n node: process.versions.node\n });\n\n let installIsValid: boolean = await installMarker.isValidAsync();\n if (!installIsValid) {\n // Need to install Rush\n console.log(`Rush version ${version} is not currently installed. Installing...`);\n\n const resourceName: string = `rush-${version}`;\n\n console.log(`Trying to acquire lock for ${resourceName}`);\n\n const lock: LockFile = await LockFile.acquireAsync(expectedRushPath, resourceName);\n installIsValid = await installMarker.isValidAsync();\n if (installIsValid) {\n console.log('Another process performed the installation.');\n } else {\n await Utilities.installPackageInDirectoryAsync({\n directory: expectedRushPath,\n packageName: isLegacyRushVersion ? '@microsoft/rush' : '@microsoft/rush-lib',\n version: version,\n tempPackageTitle: 'rush-local-install',\n maxInstallAttempts: MAX_INSTALL_ATTEMPTS,\n // This is using a local configuration to install a package in a shared global location.\n // Generally that's a bad practice, but in this case if we can successfully install\n // the package at all, we can reasonably assume it's good for all the repositories.\n // In particular, we'll assume that two different NPM registries cannot have two\n // different implementations of the same version of the same package.\n // This was needed for: https://github.com/microsoft/rushstack/issues/691\n commonRushConfigFolder: configuration ? configuration.commonRushConfigFolder : undefined,\n suppressOutput: true\n });\n\n console.log(`Successfully installed Rush version ${version} in ${expectedRushPath}.`);\n\n // If we've made it here without exception, write the flag file\n await installMarker.createAsync();\n\n lock.release();\n }\n }\n\n if (semver.lt(version, '3.0.20')) {\n // In old versions, requiring the entry point invoked the command-line parser immediately,\n // so fail if \"rushx\" or \"rush-pnpm\" was used\n RushCommandSelector.failIfNotInvokedAsRush(version);\n require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'rush'));\n } else if (semver.lt(version, '4.0.0')) {\n // In old versions, requiring the entry point invoked the command-line parser immediately,\n // so fail if \"rushx\" or \"rush-pnpm\" was used\n RushCommandSelector.failIfNotInvokedAsRush(version);\n require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'start'));\n } else {\n // Explicitly resolve the entry point for rush-lib, rather than using a simple require, because\n // newer versions of rush-lib use the package.json `exports` field, which maps\n // `lib/index` to `lib-commonjs/index.js`\n const rushLibEntrypoint: string = await Import.resolveModuleAsync({\n modulePath: '@microsoft/rush-lib/lib/index',\n baseFolderPath: expectedRushPath\n });\n const rushCliEntrypoint: typeof import('@microsoft/rush-lib') = require(rushLibEntrypoint);\n // For newer rush-lib, RushCommandSelector can test whether \"rushx\" is supported or not\n RushCommandSelector.execute(this._currentPackageVersion, rushCliEntrypoint, executeOptions);\n }\n }\n}\n"]}
|
package/lib-esm/start.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
// We're using a path-based import here to minimize the amount of code that is evaluated before
|
|
4
|
+
// we check to see if the Node.js version is too old. If, for whatever reason, Rush crashes with
|
|
5
|
+
// an old Node.js version when evaluating one of the more complex imports, we'll at least
|
|
6
|
+
// shown a meaningful error message.
|
|
7
|
+
// eslint-disable-next-line import/order
|
|
8
|
+
import { NodeJsCompatibility } from '@microsoft/rush-lib/lib/logic/NodeJsCompatibility';
|
|
9
|
+
if (NodeJsCompatibility.reportAncientIncompatibleVersion()) {
|
|
10
|
+
// The Node.js version is known to have serious incompatibilities. In that situation, the user
|
|
11
|
+
// should downgrade Rush to an older release that supported their Node.js version.
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
const alreadyReportedNodeTooNewError = NodeJsCompatibility.warnAboutVersionTooNew({
|
|
15
|
+
isRushLib: false,
|
|
16
|
+
alreadyReportedNodeTooNewError: false
|
|
17
|
+
});
|
|
18
|
+
import * as os from 'node:os';
|
|
19
|
+
import * as semver from 'semver';
|
|
20
|
+
import { Text, PackageJsonLookup } from '@rushstack/node-core-library';
|
|
21
|
+
import { Colorize, ConsoleTerminalProvider } from '@rushstack/terminal';
|
|
22
|
+
import { EnvironmentVariableNames } from '@microsoft/rush-lib';
|
|
23
|
+
import * as rushLib from '@microsoft/rush-lib';
|
|
24
|
+
import { RushCommandSelector } from './RushCommandSelector';
|
|
25
|
+
import { RushVersionSelector } from './RushVersionSelector';
|
|
26
|
+
import { MinimalRushConfiguration } from './MinimalRushConfiguration';
|
|
27
|
+
// Load the configuration
|
|
28
|
+
const configuration = MinimalRushConfiguration.loadFromDefaultLocation();
|
|
29
|
+
const currentPackageVersion = PackageJsonLookup.loadOwnPackageJson(__dirname).version;
|
|
30
|
+
let rushVersionToLoad = undefined;
|
|
31
|
+
const previewVersion = process.env[EnvironmentVariableNames.RUSH_PREVIEW_VERSION];
|
|
32
|
+
if (previewVersion) {
|
|
33
|
+
if (!semver.valid(previewVersion, false)) {
|
|
34
|
+
console.error(Colorize.red(`Invalid value for RUSH_PREVIEW_VERSION environment variable: "${previewVersion}"`));
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
rushVersionToLoad = previewVersion;
|
|
38
|
+
const lines = [];
|
|
39
|
+
lines.push(`*********************************************************************`, `* WARNING! THE "RUSH_PREVIEW_VERSION" ENVIRONMENT VARIABLE IS SET. *`, `* *`, `* You are previewing Rush version: ${Text.padEnd(previewVersion, 25)} *`);
|
|
40
|
+
if (configuration) {
|
|
41
|
+
lines.push(`* The rush.json configuration asks for: ${Text.padEnd(configuration.rushVersion, 25)} *`);
|
|
42
|
+
}
|
|
43
|
+
lines.push(`* *`, `* To restore the normal behavior, unset the RUSH_PREVIEW_VERSION *`, `* environment variable. *`, `*********************************************************************`);
|
|
44
|
+
console.error(lines.map((line) => Colorize.black(Colorize.yellowBackground(line))).join(os.EOL));
|
|
45
|
+
}
|
|
46
|
+
else if (configuration) {
|
|
47
|
+
rushVersionToLoad = configuration.rushVersion;
|
|
48
|
+
}
|
|
49
|
+
// If we are previewing an older Rush that doesn't understand the RUSH_PREVIEW_VERSION variable,
|
|
50
|
+
// then unset it.
|
|
51
|
+
if (rushVersionToLoad && semver.lt(rushVersionToLoad, '5.0.0-dev.18')) {
|
|
52
|
+
delete process.env[EnvironmentVariableNames.RUSH_PREVIEW_VERSION];
|
|
53
|
+
}
|
|
54
|
+
// Rush is "managed" if its version and configuration are dictated by a repo's rush.json
|
|
55
|
+
const isManaged = !!configuration;
|
|
56
|
+
const terminalProvider = new ConsoleTerminalProvider();
|
|
57
|
+
const launchOptions = { isManaged, alreadyReportedNodeTooNewError, terminalProvider };
|
|
58
|
+
// If we're inside a repo folder, and it's requesting a different version, then use the RushVersionManager to
|
|
59
|
+
// install it
|
|
60
|
+
if (rushVersionToLoad && rushVersionToLoad !== currentPackageVersion) {
|
|
61
|
+
const versionSelector = new RushVersionSelector(currentPackageVersion);
|
|
62
|
+
versionSelector
|
|
63
|
+
.ensureRushVersionInstalledAsync(rushVersionToLoad, configuration, launchOptions)
|
|
64
|
+
.catch((error) => {
|
|
65
|
+
console.log(Colorize.red('Error: ' + error.message));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Otherwise invoke the rush-lib that came with this rush package
|
|
70
|
+
RushCommandSelector.execute(currentPackageVersion, rushLib, launchOptions);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,+FAA+F;AAC/F,gGAAgG;AAChG,yFAAyF;AACzF,oCAAoC;AACpC,wCAAwC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAExF,IAAI,mBAAmB,CAAC,gCAAgC,EAAE,EAAE,CAAC;IAC3D,+FAA+F;IAC/F,kFAAkF;IAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,8BAA8B,GAAY,mBA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AAe;SACZ,+BAA+B,CAAC,iBAAiB,EAAE,aAAa,EAAE,aAAa,CAAC;SAChF,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;QACtB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACP,CAAC;KAAM,CAAC;IACN,iEAAiE;IACjE,mBAAmB,CAAC,OAAO,CAAC,qBAAqB,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// We're using a path-based import here to minimize the amount of code that is evaluated before\n// we check to see if the Node.js version is too old. If, for whatever reason, Rush crashes with\n// an old Node.js version when evaluating one of the more complex imports, we'll at least\n// shown a meaningful error message.\n// eslint-disable-next-line import/order\nimport { NodeJsCompatibility } from '@microsoft/rush-lib/lib/logic/NodeJsCompatibility';\n\nif (NodeJsCompatibility.reportAncientIncompatibleVersion()) {\n // The Node.js version is known to have serious incompatibilities. In that situation, the user\n // should downgrade Rush to an older release that supported their Node.js version.\n process.exit(1);\n}\n\nconst alreadyReportedNodeTooNewError: boolean = NodeJsCompatibility.warnAboutVersionTooNew({\n isRushLib: false,\n alreadyReportedNodeTooNewError: false\n});\n\nimport * as os from 'node:os';\n\nimport * as semver from 'semver';\n\nimport { Text, PackageJsonLookup } from '@rushstack/node-core-library';\nimport { Colorize, ConsoleTerminalProvider, type ITerminalProvider } from '@rushstack/terminal';\nimport { EnvironmentVariableNames } from '@microsoft/rush-lib';\nimport type { ILaunchOptions } from '@microsoft/rush-lib';\nimport * as rushLib from '@microsoft/rush-lib';\n\nimport { RushCommandSelector } from './RushCommandSelector';\nimport { RushVersionSelector } from './RushVersionSelector';\nimport { MinimalRushConfiguration } from './MinimalRushConfiguration';\n\n// Load the configuration\nconst configuration: MinimalRushConfiguration | undefined =\n MinimalRushConfiguration.loadFromDefaultLocation();\n\nconst currentPackageVersion: string = PackageJsonLookup.loadOwnPackageJson(__dirname).version;\n\nlet rushVersionToLoad: string | undefined = undefined;\n\nconst previewVersion: string | undefined = process.env[EnvironmentVariableNames.RUSH_PREVIEW_VERSION];\n\nif (previewVersion) {\n if (!semver.valid(previewVersion, false)) {\n console.error(\n Colorize.red(`Invalid value for RUSH_PREVIEW_VERSION environment variable: \"${previewVersion}\"`)\n );\n process.exit(1);\n }\n\n rushVersionToLoad = previewVersion;\n\n const lines: string[] = [];\n lines.push(\n `*********************************************************************`,\n `* WARNING! THE \"RUSH_PREVIEW_VERSION\" ENVIRONMENT VARIABLE IS SET. *`,\n `* *`,\n `* You are previewing Rush version: ${Text.padEnd(previewVersion, 25)} *`\n );\n\n if (configuration) {\n lines.push(`* The rush.json configuration asks for: ${Text.padEnd(configuration.rushVersion, 25)} *`);\n }\n\n lines.push(\n `* *`,\n `* To restore the normal behavior, unset the RUSH_PREVIEW_VERSION *`,\n `* environment variable. *`,\n `*********************************************************************`\n );\n\n console.error(lines.map((line) => Colorize.black(Colorize.yellowBackground(line))).join(os.EOL));\n} else if (configuration) {\n rushVersionToLoad = configuration.rushVersion;\n}\n\n// If we are previewing an older Rush that doesn't understand the RUSH_PREVIEW_VERSION variable,\n// then unset it.\nif (rushVersionToLoad && semver.lt(rushVersionToLoad, '5.0.0-dev.18')) {\n delete process.env[EnvironmentVariableNames.RUSH_PREVIEW_VERSION];\n}\n\n// Rush is \"managed\" if its version and configuration are dictated by a repo's rush.json\nconst isManaged: boolean = !!configuration;\n\nconst terminalProvider: ITerminalProvider = new ConsoleTerminalProvider();\n\nconst launchOptions: ILaunchOptions = { isManaged, alreadyReportedNodeTooNewError, terminalProvider };\n\n// If we're inside a repo folder, and it's requesting a different version, then use the RushVersionManager to\n// install it\nif (rushVersionToLoad && rushVersionToLoad !== currentPackageVersion) {\n const versionSelector: RushVersionSelector = new RushVersionSelector(currentPackageVersion);\n versionSelector\n .ensureRushVersionInstalledAsync(rushVersionToLoad, configuration, launchOptions)\n .catch((error: Error) => {\n console.log(Colorize.red('Error: ' + error.message));\n });\n} else {\n // Otherwise invoke the rush-lib that came with this rush package\n RushCommandSelector.execute(currentPackageVersion, rushLib, launchOptions);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rush",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.169.0",
|
|
4
4
|
"description": "A professional solution for consolidating all your JavaScript projects in one Git repo",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"install",
|
|
@@ -31,20 +31,39 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"semver": "~7.5.4",
|
|
34
|
-
"@microsoft/rush-lib": "5.
|
|
35
|
-
"@rushstack/
|
|
36
|
-
"@rushstack/
|
|
34
|
+
"@microsoft/rush-lib": "5.169.0",
|
|
35
|
+
"@rushstack/terminal": "0.22.0",
|
|
36
|
+
"@rushstack/node-core-library": "5.20.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"eslint": "~9.37.0",
|
|
40
40
|
"@types/heft-jest": "1.0.1",
|
|
41
41
|
"@types/semver": "7.5.0",
|
|
42
|
-
"@rushstack/heft": "1.
|
|
42
|
+
"@rushstack/heft": "1.2.0",
|
|
43
43
|
"local-node-rig": "1.0.0",
|
|
44
|
-
"@rushstack/rush-amazon-s3-build-cache-plugin": "5.
|
|
45
|
-
"@rushstack/rush-azure-storage-build-cache-plugin": "5.
|
|
46
|
-
"@rushstack/rush-http-build-cache-plugin": "5.
|
|
44
|
+
"@rushstack/rush-amazon-s3-build-cache-plugin": "5.169.0",
|
|
45
|
+
"@rushstack/rush-azure-storage-build-cache-plugin": "5.169.0",
|
|
46
|
+
"@rushstack/rush-http-build-cache-plugin": "5.169.0"
|
|
47
47
|
},
|
|
48
|
+
"exports": {
|
|
49
|
+
"./lib/*": {
|
|
50
|
+
"types": "./lib-dts/*.d.ts",
|
|
51
|
+
"import": "./lib-esm/*.js",
|
|
52
|
+
"require": "./lib-commonjs/*.js"
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
55
|
+
},
|
|
56
|
+
"typesVersions": {
|
|
57
|
+
"*": {
|
|
58
|
+
"lib/*": [
|
|
59
|
+
"lib-dts/*"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"sideEffects": [
|
|
64
|
+
"lib-commonjs/start.js",
|
|
65
|
+
"lib-esm/start.js"
|
|
66
|
+
],
|
|
48
67
|
"scripts": {
|
|
49
68
|
"build": "heft build --clean",
|
|
50
69
|
"start": "node lib/start-dev-docs.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RushCommandSelector.d.ts","sourceRoot":"","sources":["../src/RushCommandSelector.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAKpD;;;;;;GAMG;AACH,qBAAa,mBAAmB;WAChB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;WAS7C,OAAO,CACnB,eAAe,EAAE,MAAM,EAEvB,eAAe,EAAE,GAAG,EACpB,OAAO,EAAE,OAAO,CAAC,cAAc,GAC9B,IAAI;IAkCP,OAAO,CAAC,MAAM,CAAC,cAAc;IAK7B,OAAO,CAAC,MAAM,CAAC,eAAe;CAkB/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RushCommandSelector.js","sourceRoot":"","sources":["../src/RushCommandSelector.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAkC;AAGlC,kDAA+C;AAI/C;;;;;;GAMG;AACH,MAAa,mBAAmB;IACvB,MAAM,CAAC,sBAAsB,CAAC,OAAe;QAClD,MAAM,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,MAAM,CAAC,cAAc,CAAC,OAAe;QAC3C,OAAO,CAAC,GAAG,CAAC,mBAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QACnC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC7B,WAAW;YACX,iDAAiD;YACjD,mFAAmF;YACnF,MAAM,QAAQ,GAAW,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACtE,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACxB,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;gBAC7B,OAAO,WAAW,CAAC;YACrB,CAAC;YACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACzB,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAxED,kDAwEC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport type * as rushLib from '@microsoft/rush-lib';\nimport { Colorize } from '@rushstack/terminal';\n\ntype CommandName = 'rush' | 'rush-pnpm' | 'rushx' | undefined;\n\n/**\n * Both \"rush\" and \"rushx\" share the same src/start.ts entry point. This makes it\n * a little easier for them to share all the same startup checks and version selector\n * logic. RushCommandSelector looks at argv to determine whether we're doing \"rush\"\n * or \"rushx\" behavior, and then invokes the appropriate entry point in the selected\n * @microsoft/rush-lib.\n */\nexport class RushCommandSelector {\n public static failIfNotInvokedAsRush(version: string): void {\n const commandName: CommandName = RushCommandSelector._getCommandName();\n if (commandName !== 'rush' && commandName !== undefined) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${version} which does not support the ${commandName} command`\n );\n }\n }\n\n public static execute(\n launcherVersion: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n selectedRushLib: any,\n options: rushLib.ILaunchOptions\n ): void {\n const Rush: typeof rushLib.Rush = selectedRushLib.Rush;\n\n if (!Rush) {\n // This should be impossible unless we somehow loaded an unexpected version\n RushCommandSelector._failWithError(`Unable to find the \"Rush\" entry point in @microsoft/rush-lib`);\n }\n\n const commandName: CommandName = RushCommandSelector._getCommandName();\n\n if (commandName === 'rush-pnpm') {\n if (!Rush.launchRushPnpm) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${Rush.version}` +\n ` which does not support the \"rush-pnpm\" command`\n );\n }\n Rush.launchRushPnpm(launcherVersion, {\n isManaged: options.isManaged,\n alreadyReportedNodeTooNewError: options.alreadyReportedNodeTooNewError\n });\n } else if (commandName === 'rushx') {\n if (!Rush.launchRushX) {\n RushCommandSelector._failWithError(\n `This repository is using Rush version ${Rush.version}` +\n ` which does not support the \"rushx\" command`\n );\n }\n Rush.launchRushX(launcherVersion, options);\n } else {\n Rush.launch(launcherVersion, options);\n }\n }\n\n private static _failWithError(message: string): never {\n console.log(Colorize.red(message));\n return process.exit(1);\n }\n\n private static _getCommandName(): CommandName {\n if (process.argv.length >= 2) {\n // Example:\n // argv[0]: \"C:\\\\Program Files\\\\nodejs\\\\node.exe\"\n // argv[1]: \"C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\@microsoft\\\\rush\\\\bin\\\\rushx\"\n const basename: string = path.basename(process.argv[1]).toUpperCase();\n if (basename === 'RUSH') {\n return 'rush';\n }\n if (basename === 'RUSH-PNPM') {\n return 'rush-pnpm';\n }\n if (basename === 'RUSHX') {\n return 'rushx';\n }\n }\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RushVersionSelector.js","sourceRoot":"","sources":["../src/RushVersionSelector.ts"],"names":[],"mappings":";A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AC,IAAI,CAAC,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7F,CAAC;aAAM,CAAC;YACN,uFAAuF;YACvF,MAAM,iBAAiB,GAAO,OAAO,CACnC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CACtF,CAAC;YACF,yCAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;CACF;AA9ED,kDA8EC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport * as semver from 'semver';\n\nimport { LockFile } from '@rushstack/node-core-library';\nimport { Utilities } from '@microsoft/rush-lib/lib/utilities/Utilities';\nimport { _FlagFile, _RushGlobalFolder, type ILaunchOptions } from '@microsoft/rush-lib';\n\nimport { RushCommandSelector } from './RushCommandSelector';\nimport type { MinimalRushConfiguration } from './MinimalRushConfiguration';\n\nconst MAX_INSTALL_ATTEMPTS: number = 3;\n\nexport class RushVersionSelector {\n private _rushGlobalFolder: _RushGlobalFolder;\n private _currentPackageVersion: string;\n\n public constructor(currentPackageVersion: string) {\n this._rushGlobalFolder = new _RushGlobalFolder();\n this._currentPackageVersion = currentPackageVersion;\n }\n\n public async ensureRushVersionInstalledAsync(\n version: string,\n configuration: MinimalRushConfiguration | undefined,\n executeOptions: ILaunchOptions\n ): Promise<void> {\n const isLegacyRushVersion: boolean = semver.lt(version, '4.0.0');\n const expectedRushPath: string = path.join(this._rushGlobalFolder.nodeSpecificPath, `rush-${version}`);\n\n const installMarker: _FlagFile = new _FlagFile(expectedRushPath, 'last-install', {\n node: process.versions.node\n });\n\n let installIsValid: boolean = await installMarker.isValidAsync();\n if (!installIsValid) {\n // Need to install Rush\n console.log(`Rush version ${version} is not currently installed. Installing...`);\n\n const resourceName: string = `rush-${version}`;\n\n console.log(`Trying to acquire lock for ${resourceName}`);\n\n const lock: LockFile = await LockFile.acquire(expectedRushPath, resourceName);\n installIsValid = await installMarker.isValidAsync();\n if (installIsValid) {\n console.log('Another process performed the installation.');\n } else {\n await Utilities.installPackageInDirectoryAsync({\n directory: expectedRushPath,\n packageName: isLegacyRushVersion ? '@microsoft/rush' : '@microsoft/rush-lib',\n version: version,\n tempPackageTitle: 'rush-local-install',\n maxInstallAttempts: MAX_INSTALL_ATTEMPTS,\n // This is using a local configuration to install a package in a shared global location.\n // Generally that's a bad practice, but in this case if we can successfully install\n // the package at all, we can reasonably assume it's good for all the repositories.\n // In particular, we'll assume that two different NPM registries cannot have two\n // different implementations of the same version of the same package.\n // This was needed for: https://github.com/microsoft/rushstack/issues/691\n commonRushConfigFolder: configuration ? configuration.commonRushConfigFolder : undefined,\n suppressOutput: true\n });\n\n console.log(`Successfully installed Rush version ${version} in ${expectedRushPath}.`);\n\n // If we've made it here without exception, write the flag file\n await installMarker.createAsync();\n\n lock.release();\n }\n }\n\n if (semver.lt(version, '3.0.20')) {\n // In old versions, requiring the entry point invoked the command-line parser immediately,\n // so fail if \"rushx\" or \"rush-pnpm\" was used\n RushCommandSelector.failIfNotInvokedAsRush(version);\n require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'rush'));\n } else if (semver.lt(version, '4.0.0')) {\n // In old versions, requiring the entry point invoked the command-line parser immediately,\n // so fail if \"rushx\" or \"rush-pnpm\" was used\n RushCommandSelector.failIfNotInvokedAsRush(version);\n require(path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush', 'lib', 'start'));\n } else {\n // For newer rush-lib, RushCommandSelector can test whether \"rushx\" is supported or not\n const rushCliEntrypoint: {} = require(\n path.join(expectedRushPath, 'node_modules', '@microsoft', 'rush-lib', 'lib', 'index')\n );\n RushCommandSelector.execute(this._currentPackageVersion, rushCliEntrypoint, executeOptions);\n }\n }\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|