diff --git a/build-tests/install-test-workspace/workspace/common/pnpm-lock.yaml b/build-tests/install-test-workspace/workspace/common/pnpm-lock.yaml index 465cd095a32..ec8bbbce86e 100644 --- a/build-tests/install-test-workspace/workspace/common/pnpm-lock.yaml +++ b/build-tests/install-test-workspace/workspace/common/pnpm-lock.yaml @@ -4,13 +4,13 @@ importers: rush-lib-test: specifiers: - '@microsoft/rush-lib': file:microsoft-rush-lib-5.90.2.tgz + '@microsoft/rush-lib': file:microsoft-rush-lib-5.93.0.tgz '@types/node': 14.18.36 colors: ^1.4.0 rimraf: ^4.1.2 typescript: ~4.8.4 dependencies: - '@microsoft/rush-lib': file:../temp/tarballs/microsoft-rush-lib-5.90.2.tgz_@types+node@14.18.36 + '@microsoft/rush-lib': file:../temp/tarballs/microsoft-rush-lib-5.93.0.tgz_@types+node@14.18.36 colors: 1.4.0 devDependencies: '@types/node': 14.18.36 @@ -19,17 +19,17 @@ importers: rush-sdk-test: specifiers: - '@microsoft/rush-lib': file:microsoft-rush-lib-5.90.2.tgz - '@rushstack/rush-sdk': file:rushstack-rush-sdk-5.90.2.tgz + '@microsoft/rush-lib': file:microsoft-rush-lib-5.93.0.tgz + '@rushstack/rush-sdk': file:rushstack-rush-sdk-5.93.0.tgz '@types/node': 14.18.36 colors: ^1.4.0 rimraf: ^4.1.2 typescript: ~4.8.4 dependencies: - '@rushstack/rush-sdk': file:../temp/tarballs/rushstack-rush-sdk-5.90.2.tgz_@types+node@14.18.36 + '@rushstack/rush-sdk': file:../temp/tarballs/rushstack-rush-sdk-5.93.0.tgz_@types+node@14.18.36 colors: 1.4.0 devDependencies: - '@microsoft/rush-lib': file:../temp/tarballs/microsoft-rush-lib-5.90.2.tgz_@types+node@14.18.36 + '@microsoft/rush-lib': file:../temp/tarballs/microsoft-rush-lib-5.93.0.tgz_@types+node@14.18.36 '@types/node': 14.18.36 rimraf: 4.1.2 typescript: 4.8.4 @@ -395,9 +395,12 @@ packages: /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 14.18.36 + '@types/node': 12.20.24 form-data: 3.0.1 + /@types/node/12.20.24: + resolution: {integrity: sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ==} + /@types/node/14.18.36: resolution: {integrity: sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ==} @@ -2103,7 +2106,7 @@ packages: hasBin: true /json-buffer/3.0.0: - resolution: {integrity: sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=} + resolution: {integrity: sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==} /json-parse-even-better-errors/2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} @@ -3653,11 +3656,11 @@ packages: optionalDependencies: commander: 2.20.3 - file:../temp/tarballs/microsoft-rush-lib-5.90.2.tgz_@types+node@14.18.36: - resolution: {tarball: file:../temp/tarballs/microsoft-rush-lib-5.90.2.tgz} - id: file:../temp/tarballs/microsoft-rush-lib-5.90.2.tgz + file:../temp/tarballs/microsoft-rush-lib-5.93.0.tgz_@types+node@14.18.36: + resolution: {tarball: file:../temp/tarballs/microsoft-rush-lib-5.93.0.tgz} + id: file:../temp/tarballs/microsoft-rush-lib-5.93.0.tgz name: '@microsoft/rush-lib' - version: 5.90.2 + version: 5.93.0 engines: {node: '>=5.6.0'} dependencies: '@pnpm/link-bins': 5.3.25 @@ -3890,11 +3893,11 @@ packages: resolve: 1.22.1 strip-json-comments: 3.1.1 - file:../temp/tarballs/rushstack-rush-sdk-5.90.2.tgz_@types+node@14.18.36: - resolution: {tarball: file:../temp/tarballs/rushstack-rush-sdk-5.90.2.tgz} - id: file:../temp/tarballs/rushstack-rush-sdk-5.90.2.tgz + file:../temp/tarballs/rushstack-rush-sdk-5.93.0.tgz_@types+node@14.18.36: + resolution: {tarball: file:../temp/tarballs/rushstack-rush-sdk-5.93.0.tgz} + id: file:../temp/tarballs/rushstack-rush-sdk-5.93.0.tgz name: '@rushstack/rush-sdk' - version: 5.90.2 + version: 5.93.0 dependencies: '@rushstack/node-core-library': file:../temp/tarballs/rushstack-node-core-library-3.55.2.tgz_@types+node@14.18.36 '@types/node-fetch': 2.6.2 diff --git a/common/changes/@microsoft/rush/enelson-rush-lib-path_2023-02-17-12-46.json b/common/changes/@microsoft/rush/enelson-rush-lib-path_2023-02-17-12-46.json new file mode 100644 index 00000000000..744d5dfbd52 --- /dev/null +++ b/common/changes/@microsoft/rush/enelson-rush-lib-path_2023-02-17-12-46.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Rename internal RUSH_LIB_PATH environment variable to _RUSH_LIB_PATH.", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/common/reviews/api/rush-lib.api.md b/common/reviews/api/rush-lib.api.md index 223255445a5..206bc26cc51 100644 --- a/common/reviews/api/rush-lib.api.md +++ b/common/reviews/api/rush-lib.api.md @@ -177,7 +177,7 @@ export enum EnvironmentVariableNames { RUSH_GIT_BINARY_PATH = "RUSH_GIT_BINARY_PATH", RUSH_GLOBAL_FOLDER = "RUSH_GLOBAL_FOLDER", RUSH_INVOKED_FOLDER = "RUSH_INVOKED_FOLDER", - RUSH_LIB_PATH = "RUSH_LIB_PATH", + RUSH_LIB_PATH = "_RUSH_LIB_PATH", RUSH_PARALLELISM = "RUSH_PARALLELISM", RUSH_PNPM_STORE_PATH = "RUSH_PNPM_STORE_PATH", RUSH_PNPM_VERIFY_STORE_INTEGRITY = "RUSH_PNPM_VERIFY_STORE_INTEGRITY", diff --git a/libraries/rush-lib/src/api/EnvironmentConfiguration.ts b/libraries/rush-lib/src/api/EnvironmentConfiguration.ts index 639e64b6e80..99b34ff369b 100644 --- a/libraries/rush-lib/src/api/EnvironmentConfiguration.ts +++ b/libraries/rush-lib/src/api/EnvironmentConfiguration.ts @@ -154,10 +154,10 @@ export enum EnvironmentVariableNames { RUSH_TAR_BINARY_PATH = 'RUSH_TAR_BINARY_PATH', /** - * Explicitly specifies the path for the version of `@microsoft/rush-lib` being executed. + * Internal variable that explicitly specifies the path for the version of `@microsoft/rush-lib` being executed. * Will be set upon loading Rush. */ - RUSH_LIB_PATH = 'RUSH_LIB_PATH', + RUSH_LIB_PATH = '_RUSH_LIB_PATH', /** * When Rush executes shell scripts, it sometimes changes the working directory to be a project folder or diff --git a/libraries/rush-lib/src/cli/actions/test/removeRepo/common/temp/rush#90625.lock b/libraries/rush-lib/src/cli/actions/test/removeRepo/common/temp/rush#90625.lock deleted file mode 100644 index b2b0d4002b8..00000000000 --- a/libraries/rush-lib/src/cli/actions/test/removeRepo/common/temp/rush#90625.lock +++ /dev/null @@ -1 +0,0 @@ -Fri Jan 27 01:50:33 2023 \ No newline at end of file diff --git a/libraries/rush-sdk/README.md b/libraries/rush-sdk/README.md index 1cdb6b7e5c7..73ec410e3c7 100644 --- a/libraries/rush-sdk/README.md +++ b/libraries/rush-sdk/README.md @@ -10,7 +10,7 @@ The **@rushstack/rush-sdk** package acts as a lightweight proxy for accessing th 2. When authoring unit tests for a Rush plugin, developers should add **@microsoft/rush-lib** to their **package.json** `devDependencies`. In this context, **@rushstack/rush-sdk** will resolve to that instance for testing purposes. -3. For projects within a monorepo that use **@rushstack/rush-sdk** during their build process, child processes will inherit the installation of Rush that invoked them. This is communicated using the `RUSH_LIB_PATH` environment variable. +3. For projects within a monorepo that use **@rushstack/rush-sdk** during their build process, child processes will inherit the installation of Rush that invoked them. This is communicated using the `_RUSH_LIB_PATH` environment variable. 4. For scripts and tools that are designed to be used in a Rush monorepo, in the future **@rushstack/rush-sdk** will automatically invoke **install-run-rush.js** and load the local installation. This ensures that tools load a compatible version of the Rush engine for the given branch. Once this is implemented, **@rushstack/rush-sdk** can replace **@microsoft/rush-lib** entirely as the official API interface, with the latter serving as the underlying implementation. diff --git a/libraries/rush-sdk/src/index.ts b/libraries/rush-sdk/src/index.ts index 0407765841e..2677e9bef8d 100644 --- a/libraries/rush-sdk/src/index.ts +++ b/libraries/rush-sdk/src/index.ts @@ -93,9 +93,9 @@ if (rushLibModule === undefined) { } // SCENARIO 3: A tool or script has been invoked as a child process by an instance of "rush-lib" and can use the -// version that invoked it. In this case, use process.env.RUSH_LIB_PATH to find "rush-lib". +// version that invoked it. In this case, use process.env._RUSH_LIB_PATH to find "rush-lib". if (rushLibModule === undefined) { - const rushLibVariable: 'RUSH_LIB_PATH' = 'RUSH_LIB_PATH'; + const rushLibVariable: '_RUSH_LIB_PATH' = '_RUSH_LIB_PATH'; const rushLibPath: string | undefined = process.env[rushLibVariable]; if (rushLibPath) { terminal.writeVerboseLine( diff --git a/libraries/rush-sdk/src/test/__snapshots__/script.test.ts.snap b/libraries/rush-sdk/src/test/__snapshots__/script.test.ts.snap index 2425c8c2688..36bce37042e 100644 --- a/libraries/rush-sdk/src/test/__snapshots__/script.test.ts.snap +++ b/libraries/rush-sdk/src/test/__snapshots__/script.test.ts.snap @@ -3,8 +3,8 @@ exports[`@rushstack/rush-sdk Should load via env when Rush has loaded (for child processes): stderr 1`] = `""`; exports[`@rushstack/rush-sdk Should load via env when Rush has loaded (for child processes): stdout 1`] = ` -"Try to load @microsoft/rush-lib from process.env.RUSH_LIB_PATH from caller package -Loaded @microsoft/rush-lib from process.env.RUSH_LIB_PATH +"Try to load @microsoft/rush-lib from process.env._RUSH_LIB_PATH from caller package +Loaded @microsoft/rush-lib from process.env._RUSH_LIB_PATH [ '_rushSdk_loadInternalModule', 'ApprovedPackagesConfiguration', @@ -67,10 +67,10 @@ Loaded @microsoft/rush-lib installed by install-run-rush [ '_rushSdk_loadInternalModule', 'foo' ]" `; -exports[`@rushstack/rush-sdk Should load via process.env.RUSH_LIB_PATH (for child processes): stderr 1`] = `""`; +exports[`@rushstack/rush-sdk Should load via process.env._RUSH_LIB_PATH (for child processes): stderr 1`] = `""`; -exports[`@rushstack/rush-sdk Should load via process.env.RUSH_LIB_PATH (for child processes): stdout 1`] = ` -"Try to load @microsoft/rush-lib from process.env.RUSH_LIB_PATH from caller package -Loaded @microsoft/rush-lib from process.env.RUSH_LIB_PATH +exports[`@rushstack/rush-sdk Should load via process.env._RUSH_LIB_PATH (for child processes): stdout 1`] = ` +"Try to load @microsoft/rush-lib from process.env._RUSH_LIB_PATH from caller package +Loaded @microsoft/rush-lib from process.env._RUSH_LIB_PATH [ '_rushSdk_loadInternalModule', 'foo' ]" `; diff --git a/libraries/rush-sdk/src/test/script.test.ts b/libraries/rush-sdk/src/test/script.test.ts index ffe209484a2..e1919b55694 100644 --- a/libraries/rush-sdk/src/test/script.test.ts +++ b/libraries/rush-sdk/src/test/script.test.ts @@ -23,7 +23,7 @@ console.log(Object.keys(require(${JSON.stringify(rushSdkPath)})));` environment: { ...process.env, RUSH_SDK_DEBUG: '1', - RUSH_LIB_PATH: '' // Need to clear if invoked via Rush + _RUSH_LIB_PATH: '' // Need to clear if invoked via Rush } } ); @@ -46,7 +46,7 @@ console.log(Object.keys(require(${JSON.stringify(rushSdkPath)})));` environment: { ...process.env, RUSH_SDK_DEBUG: '1', - RUSH_LIB_PATH: '' // Need to clear if invoked via Rush + _RUSH_LIB_PATH: '' // Need to clear if invoked via Rush } } ); @@ -55,7 +55,7 @@ console.log(Object.keys(require(${JSON.stringify(rushSdkPath)})));` expect(result.status).toBe(0); }); - it('Should load via process.env.RUSH_LIB_PATH (for child processes)', () => { + it('Should load via process.env._RUSH_LIB_PATH (for child processes)', () => { const result = Executable.spawnSync( 'node', ['-e', `console.log(Object.keys(require(${JSON.stringify(rushSdkPath)})));`], @@ -64,7 +64,7 @@ console.log(Object.keys(require(${JSON.stringify(rushSdkPath)})));` environment: { ...process.env, RUSH_SDK_DEBUG: '1', - RUSH_LIB_PATH: mockRushLibPath + _RUSH_LIB_PATH: mockRushLibPath } } ); @@ -96,7 +96,7 @@ console.log(Object.keys(require(${JSON.stringify(rushSdkPath)}))); environment: { ...process.env, RUSH_SDK_DEBUG: '1', - RUSH_LIB_PATH: '' // Need to clear if invoked via Rush + _RUSH_LIB_PATH: '' // Need to clear if invoked via Rush } } );