From a9d4568dffeda1fd64a2f1cd9763d96fdd054f4c Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Sat, 8 Jun 2024 01:29:00 -0700 Subject: [PATCH 01/11] feat: load rush-lib from rush global folder --- .../config/subspaces/default/pnpm-lock.yaml | 9 ++ libraries/rush-sdk/config/api-extractor.json | 2 +- libraries/rush-sdk/config/heft.json | 11 +- libraries/rush-sdk/package.json | 5 +- libraries/rush-sdk/src/index.ts | 110 +++++++++++------- libraries/rush-sdk/tsconfig.json | 2 +- libraries/rush-sdk/webpack.config.js | 76 ++++++++++++ 7 files changed, 171 insertions(+), 44 deletions(-) create mode 100644 libraries/rush-sdk/webpack.config.js diff --git a/common/config/subspaces/default/pnpm-lock.yaml b/common/config/subspaces/default/pnpm-lock.yaml index 590924e6452..7eebc6d7eb8 100644 --- a/common/config/subspaces/default/pnpm-lock.yaml +++ b/common/config/subspaces/default/pnpm-lock.yaml @@ -3439,12 +3439,18 @@ importers: '@rushstack/heft': specifier: workspace:* version: link:../../apps/heft + '@rushstack/heft-webpack5-plugin': + specifier: workspace:* + version: link:../../heft-plugins/heft-webpack5-plugin '@rushstack/stream-collator': specifier: workspace:* version: link:../stream-collator '@rushstack/ts-command-line': specifier: workspace:* version: link:../ts-command-line + '@rushstack/webpack-preserve-dynamic-require-plugin': + specifier: workspace:* + version: link:../../webpack/preserve-dynamic-require-plugin '@types/semver': specifier: 7.5.0 version: 7.5.0 @@ -3454,6 +3460,9 @@ importers: local-node-rig: specifier: workspace:* version: link:../../rigs/local-node-rig + webpack: + specifier: ~5.82.1 + version: 5.82.1 ../../../libraries/rush-themed-ui: dependencies: diff --git a/libraries/rush-sdk/config/api-extractor.json b/libraries/rush-sdk/config/api-extractor.json index 71e1a1a61b0..6ac06d0c07e 100644 --- a/libraries/rush-sdk/config/api-extractor.json +++ b/libraries/rush-sdk/config/api-extractor.json @@ -1,7 +1,7 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "/lib-shim/loader.d.ts", + "mainEntryPointFilePath": "/lib-commonjs/loader.d.ts", "apiReport": { "enabled": true, diff --git a/libraries/rush-sdk/config/heft.json b/libraries/rush-sdk/config/heft.json index 613da51dfa5..5ae24f8e554 100644 --- a/libraries/rush-sdk/config/heft.json +++ b/libraries/rush-sdk/config/heft.json @@ -32,13 +32,20 @@ "taskDependencies": ["copy-rush-lib-types"] }, - "generate-stubs": { + "webpack": { "taskDependencies": ["typescript"], + "taskPlugin": { + "pluginPackage": "@rushstack/heft-webpack5-plugin" + } + }, + + "generate-stubs": { + "taskDependencies": ["webpack"], "taskPlugin": { "pluginPackage": "@rushstack/heft", "pluginName": "run-script-plugin", "options": { - "scriptPath": "./lib-shim/generate-stubs.js" + "scriptPath": "./lib-commonjs/generate-stubs.js" } } } diff --git a/libraries/rush-sdk/package.json b/libraries/rush-sdk/package.json index 1be5762697e..575d48e4c70 100644 --- a/libraries/rush-sdk/package.json +++ b/libraries/rush-sdk/package.json @@ -37,9 +37,12 @@ "@microsoft/rush-lib": "workspace:*", "@rushstack/heft": "workspace:*", "local-node-rig": "workspace:*", + "@rushstack/heft-webpack5-plugin": "workspace:*", "@rushstack/stream-collator": "workspace:*", "@rushstack/ts-command-line": "workspace:*", + "@rushstack/webpack-preserve-dynamic-require-plugin": "workspace:*", "@types/semver": "7.5.0", - "@types/webpack-env": "1.18.0" + "@types/webpack-env": "1.18.0", + "webpack": "~5.82.1" } } diff --git a/libraries/rush-sdk/src/index.ts b/libraries/rush-sdk/src/index.ts index 56d3c7eb276..f882531e57d 100644 --- a/libraries/rush-sdk/src/index.ts +++ b/libraries/rush-sdk/src/index.ts @@ -21,7 +21,9 @@ import { sdkContext } from './helpers'; -const verboseEnabled: boolean = typeof process !== 'undefined' && process.env.RUSH_SDK_DEBUG === '1'; +const verboseEnabled: boolean = + typeof process !== 'undefined' && + (process.env.RUSH_SDK_DEBUG === '1' || process.env._RUSH_SDK_DEBUG === '1'); const terminal: Terminal = new Terminal( new ConsoleTerminalProvider({ verboseEnabled @@ -31,6 +33,7 @@ const terminal: Terminal = new Terminal( declare const global: typeof globalThis & { ___rush___rushLibModule?: RushLibModuleType; ___rush___rushLibModuleFromEnvironment?: RushLibModuleType; + ___rush___rushLibModuleFromRushGlobalFolder?: RushLibModuleType; ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType; }; @@ -42,6 +45,7 @@ if (sdkContext.rushLibModule === undefined) { sdkContext.rushLibModule = global.___rush___rushLibModule || global.___rush___rushLibModuleFromEnvironment || + global.___rush___rushLibModuleFromRushGlobalFolder || global.___rush___rushLibModuleFromInstallAndRunRush; } @@ -111,7 +115,8 @@ if (sdkContext.rushLibModule === undefined) { } // SCENARIO 4: A standalone tool or script depends on "rush-sdk", and is meant to be used inside a monorepo folder. -// In this case, we can use install-run-rush.js to obtain the appropriate rush-lib version for the monorepo. +// In this case, we can first load the rush-lib version in rush global folder. If the expected version is not installed, +// using install-run-rush.js to obtain the appropriate rush-lib version for the monorepo. if (sdkContext.rushLibModule === undefined) { try { const rushJsonPath: string | undefined = tryFindRushJsonLocation(process.cwd()); @@ -126,51 +131,78 @@ if (sdkContext.rushLibModule === undefined) { const rushJson: JsonObject = JsonFile.load(rushJsonPath); const { rushVersion } = rushJson; - const installRunNodeModuleFolder: string = path.join( - monorepoRoot, - `common/temp/install-run/@microsoft+rush@${rushVersion}` - ); - try { - // First, try to load the version of "rush-lib" that was installed by install-run-rush.js - terminal.writeVerboseLine(`Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`); - sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder); - } catch (e1) { - let installAndRunRushStderrContent: string = ''; - try { - const installAndRunRushJSPath: string = path.join(monorepoRoot, 'common/scripts/install-run-rush.js'); + const { RushGlobalFolder } = require('@microsoft/rush-lib/lib-esnext/api/RushGlobalFolder'); + terminal.writeLine(RushGlobalFolder); + terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from rush global folder`); + const rushGlobalFolder: typeof RushGlobalFolder = new RushGlobalFolder(); + // The path needs to keep align with the logic inside RushVersionSelector + const expectedGlobalRushInstalledFolder: string = path.join( + rushGlobalFolder.nodeSpecificPath, + `rush-${rushVersion}` + ); + terminal.writeVerboseLine( + `The expected global rush installed folder is "${expectedGlobalRushInstalledFolder}"` + ); + sdkContext.rushLibModule = requireRushLibUnderFolderPath(expectedGlobalRushInstalledFolder); + } catch (e) { + terminal.writeVerboseLine(`Failed to load ${RUSH_LIB_NAME} from rush global folder: ${e.message}`); + } - terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...'); + if (sdkContext.rushLibModule !== undefined) { + // to track which scenario is active and how it got initialized. + global.___rush___rushLibModuleFromRushGlobalFolder = sdkContext.rushLibModule; + terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed from rush global folder`); + } else { + const installRunNodeModuleFolder: string = path.join( + monorepoRoot, + `common/temp/install-run/@microsoft+rush@${rushVersion}` + ); - const installAndRunRushProcess: SpawnSyncReturns = Executable.spawnSync( - 'node', - [installAndRunRushJSPath, '--help'], - { - stdio: 'pipe' + try { + // First, try to load the version of "rush-lib" that was installed by install-run-rush.js + terminal.writeVerboseLine(`Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`); + sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder); + } catch (e1) { + let installAndRunRushStderrContent: string = ''; + try { + const installAndRunRushJSPath: string = path.join( + monorepoRoot, + 'common/scripts/install-run-rush.js' + ); + + terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...'); + + const installAndRunRushProcess: SpawnSyncReturns = Executable.spawnSync( + 'node', + [installAndRunRushJSPath, '--help'], + { + stdio: 'pipe' + } + ); + + installAndRunRushStderrContent = installAndRunRushProcess.stderr; + if (installAndRunRushProcess.status !== 0) { + throw new Error(`The ${RUSH_LIB_NAME} package failed to install`); } - ); - installAndRunRushStderrContent = installAndRunRushProcess.stderr; - if (installAndRunRushProcess.status !== 0) { - throw new Error(`The ${RUSH_LIB_NAME} package failed to install`); + // Retry to load "rush-lib" after install-run-rush run + terminal.writeVerboseLine( + `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time` + ); + sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder); + } catch (e2) { + // eslint-disable-next-line no-console + console.error(`${installAndRunRushStderrContent}`); + throw new Error(`The ${RUSH_LIB_NAME} package failed to load`); } - - // Retry to load "rush-lib" after install-run-rush run - terminal.writeVerboseLine( - `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time` - ); - sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder); - } catch (e2) { - // eslint-disable-next-line no-console - console.error(`${installAndRunRushStderrContent}`); - throw new Error(`The ${RUSH_LIB_NAME} package failed to load`); } - } - if (sdkContext.rushLibModule !== undefined) { - // to track which scenario is active and how it got initialized. - global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.rushLibModule; - terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed by install-run-rush`); + if (sdkContext.rushLibModule !== undefined) { + // to track which scenario is active and how it got initialized. + global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.rushLibModule; + terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed by install-run-rush`); + } } } catch (e) { // no-catch diff --git a/libraries/rush-sdk/tsconfig.json b/libraries/rush-sdk/tsconfig.json index 001d63e317f..83f4fb550b8 100644 --- a/libraries/rush-sdk/tsconfig.json +++ b/libraries/rush-sdk/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "./node_modules/local-node-rig/profiles/default/tsconfig-base.json", "compilerOptions": { - "outDir": "lib-shim", + "outDir": "lib-commonjs", "types": [ "node", "heft-jest", diff --git a/libraries/rush-sdk/webpack.config.js b/libraries/rush-sdk/webpack.config.js new file mode 100644 index 00000000000..209a8b2b732 --- /dev/null +++ b/libraries/rush-sdk/webpack.config.js @@ -0,0 +1,76 @@ +/* eslint-env es6 */ +'use strict'; + +const webpack = require('webpack'); +const { PackageJsonLookup } = require('@rushstack/node-core-library'); +const { PreserveDynamicRequireWebpackPlugin } = require('@rushstack/webpack-preserve-dynamic-require-plugin'); + +module.exports = () => { + const packageJson = PackageJsonLookup.loadOwnPackageJson(__dirname); + + const externalDependencyNames = new Set([...Object.keys(packageJson.dependencies || {})]); + + // Explicitly exclude @microsoft/rush-lib + externalDependencyNames.delete('@microsoft/rush-lib'); + + return { + context: __dirname, + mode: 'development', // So the output isn't minified + devtool: 'source-map', + entry: { + index: `${__dirname}/lib-commonjs/index.js`, + loader: `${__dirname}/lib-commonjs/loader.js` + }, + output: { + path: `${__dirname}/lib-shim`, + filename: '[name].js', + chunkFilename: 'chunks/[name].js', + library: { + type: 'commonjs2' + } + }, + target: 'node', + plugins: [ + new PreserveDynamicRequireWebpackPlugin(), + new webpack.ids.DeterministicModuleIdsPlugin({ + maxLength: 6 + }) + ], + externals: [ + ({ request }, callback) => { + let packageName; + let firstSlashIndex = request.indexOf('/'); + if (firstSlashIndex === -1) { + packageName = request; + } else if (request.startsWith('@')) { + let secondSlash = request.indexOf('/', firstSlashIndex + 1); + if (secondSlash === -1) { + packageName = request; + } else { + packageName = request.substring(0, secondSlash); + } + } else { + packageName = request.substring(0, firstSlashIndex); + } + + if (externalDependencyNames.has(packageName)) { + callback(null, `commonjs ${request}`); + } else { + callback(); + } + } + ], + optimization: { + splitChunks: { + chunks: 'all', + minChunks: 1, + cacheGroups: { + commons: { + name: 'commons', + chunks: 'initial' + } + } + } + } + }; +}; From 64a02889581837a0d9854492ca2f99911ed80743 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Sat, 8 Jun 2024 01:34:08 -0700 Subject: [PATCH 02/11] chore: rush change --- ...h-sdk-load-from-global-folder_2024-06-08-08-34.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@microsoft/rush/feat-rush-sdk-load-from-global-folder_2024-06-08-08-34.json diff --git a/common/changes/@microsoft/rush/feat-rush-sdk-load-from-global-folder_2024-06-08-08-34.json b/common/changes/@microsoft/rush/feat-rush-sdk-load-from-global-folder_2024-06-08-08-34.json new file mode 100644 index 00000000000..3b0ef16d1a3 --- /dev/null +++ b/common/changes/@microsoft/rush/feat-rush-sdk-load-from-global-folder_2024-06-08-08-34.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Improve `@rushtack/rush-sdk` and make it reuse `@microsoft/rush-lib` from rush global folder", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file From c916052ac20a790a43c7318333506a8b94154163 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Thu, 20 Jun 2024 19:43:37 -0700 Subject: [PATCH 03/11] Apply suggestions from code review Co-authored-by: Ian Clanton-Thuon --- libraries/rush-sdk/config/heft.json | 2 +- libraries/rush-sdk/src/index.ts | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/libraries/rush-sdk/config/heft.json b/libraries/rush-sdk/config/heft.json index 5ae24f8e554..636720af80a 100644 --- a/libraries/rush-sdk/config/heft.json +++ b/libraries/rush-sdk/config/heft.json @@ -40,7 +40,7 @@ }, "generate-stubs": { - "taskDependencies": ["webpack"], + "taskDependencies": ["typescript"], "taskPlugin": { "pluginPackage": "@rushstack/heft", "pluginName": "run-script-plugin", diff --git a/libraries/rush-sdk/src/index.ts b/libraries/rush-sdk/src/index.ts index f882531e57d..6839c6f6793 100644 --- a/libraries/rush-sdk/src/index.ts +++ b/libraries/rush-sdk/src/index.ts @@ -137,10 +137,7 @@ if (sdkContext.rushLibModule === undefined) { terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from rush global folder`); const rushGlobalFolder: typeof RushGlobalFolder = new RushGlobalFolder(); // The path needs to keep align with the logic inside RushVersionSelector - const expectedGlobalRushInstalledFolder: string = path.join( - rushGlobalFolder.nodeSpecificPath, - `rush-${rushVersion}` - ); + const expectedGlobalRushInstalledFolder: string = `${rushGlobalFolder.nodeSpecificPath}/rush-${rushVersion}` terminal.writeVerboseLine( `The expected global rush installed folder is "${expectedGlobalRushInstalledFolder}"` ); @@ -154,10 +151,7 @@ if (sdkContext.rushLibModule === undefined) { global.___rush___rushLibModuleFromRushGlobalFolder = sdkContext.rushLibModule; terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed from rush global folder`); } else { - const installRunNodeModuleFolder: string = path.join( - monorepoRoot, - `common/temp/install-run/@microsoft+rush@${rushVersion}` - ); + const installRunNodeModuleFolder: string = `${monorepoRoot}/common/temp/install-run/@microsoft+rush@${rushVersion}` try { // First, try to load the version of "rush-lib" that was installed by install-run-rush.js @@ -166,10 +160,7 @@ if (sdkContext.rushLibModule === undefined) { } catch (e1) { let installAndRunRushStderrContent: string = ''; try { - const installAndRunRushJSPath: string = path.join( - monorepoRoot, - 'common/scripts/install-run-rush.js' - ); + const installAndRunRushJSPath: string = `${monorepoRoot}/common/scripts/install-run-rush.js`; terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...'); From 85016a21bc5eceaa45c82f7ca82b1fc01edafb35 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Thu, 20 Jun 2024 20:11:35 -0700 Subject: [PATCH 04/11] chore: changes according to code review --- libraries/rush-sdk/config/heft.json | 2 +- libraries/rush-sdk/config/typescript.json | 12 ++++++++++++ libraries/rush-sdk/src/index.ts | 7 +++---- libraries/rush-sdk/src/typings.d.ts | 1 + libraries/rush-sdk/webpack.config.js | 11 +++-------- 5 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 libraries/rush-sdk/config/typescript.json create mode 100644 libraries/rush-sdk/src/typings.d.ts diff --git a/libraries/rush-sdk/config/heft.json b/libraries/rush-sdk/config/heft.json index 636720af80a..328e456a115 100644 --- a/libraries/rush-sdk/config/heft.json +++ b/libraries/rush-sdk/config/heft.json @@ -9,7 +9,7 @@ // TODO: Add comments "phasesByName": { "build": { - "cleanFiles": [{ "includeGlobs": ["lib-shim"] }], + "cleanFiles": [{ "includeGlobs": ["lib-shim", "lib-esnext"] }], "tasksByName": { "copy-rush-lib-types": { diff --git a/libraries/rush-sdk/config/typescript.json b/libraries/rush-sdk/config/typescript.json new file mode 100644 index 00000000000..587de5fc0f8 --- /dev/null +++ b/libraries/rush-sdk/config/typescript.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json", + + "extends": "local-node-rig/profiles/default/config/typescript.json", + + "additionalModuleKindsToEmit": [ + { + "moduleKind": "esnext", + "outFolderName": "lib-esnext" + } + ] +} diff --git a/libraries/rush-sdk/src/index.ts b/libraries/rush-sdk/src/index.ts index 6839c6f6793..4f69c81c841 100644 --- a/libraries/rush-sdk/src/index.ts +++ b/libraries/rush-sdk/src/index.ts @@ -10,6 +10,7 @@ import { Executable } from '@rushstack/node-core-library'; import { Terminal, ConsoleTerminalProvider } from '@rushstack/terminal'; +import { RushGlobalFolder } from '@microsoft/rush-lib/lib-esnext/api/RushGlobalFolder'; import type { SpawnSyncReturns } from 'child_process'; import { RUSH_LIB_NAME, @@ -132,12 +133,10 @@ if (sdkContext.rushLibModule === undefined) { const { rushVersion } = rushJson; try { - const { RushGlobalFolder } = require('@microsoft/rush-lib/lib-esnext/api/RushGlobalFolder'); - terminal.writeLine(RushGlobalFolder); terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from rush global folder`); const rushGlobalFolder: typeof RushGlobalFolder = new RushGlobalFolder(); // The path needs to keep align with the logic inside RushVersionSelector - const expectedGlobalRushInstalledFolder: string = `${rushGlobalFolder.nodeSpecificPath}/rush-${rushVersion}` + const expectedGlobalRushInstalledFolder: string = `${rushGlobalFolder.nodeSpecificPath}/rush-${rushVersion}`; terminal.writeVerboseLine( `The expected global rush installed folder is "${expectedGlobalRushInstalledFolder}"` ); @@ -151,7 +150,7 @@ if (sdkContext.rushLibModule === undefined) { global.___rush___rushLibModuleFromRushGlobalFolder = sdkContext.rushLibModule; terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed from rush global folder`); } else { - const installRunNodeModuleFolder: string = `${monorepoRoot}/common/temp/install-run/@microsoft+rush@${rushVersion}` + const installRunNodeModuleFolder: string = `${monorepoRoot}/common/temp/install-run/@microsoft+rush@${rushVersion}`; try { // First, try to load the version of "rush-lib" that was installed by install-run-rush.js diff --git a/libraries/rush-sdk/src/typings.d.ts b/libraries/rush-sdk/src/typings.d.ts new file mode 100644 index 00000000000..818bbcc2175 --- /dev/null +++ b/libraries/rush-sdk/src/typings.d.ts @@ -0,0 +1 @@ +declare module '@microsoft/rush-lib/lib-esnext/api/RushGlobalFolder'; diff --git a/libraries/rush-sdk/webpack.config.js b/libraries/rush-sdk/webpack.config.js index 209a8b2b732..44607aeb5d1 100644 --- a/libraries/rush-sdk/webpack.config.js +++ b/libraries/rush-sdk/webpack.config.js @@ -18,8 +18,8 @@ module.exports = () => { mode: 'development', // So the output isn't minified devtool: 'source-map', entry: { - index: `${__dirname}/lib-commonjs/index.js`, - loader: `${__dirname}/lib-commonjs/loader.js` + index: `${__dirname}/lib-esnext/index.js`, + loader: `${__dirname}/lib-esnext/loader.js` }, output: { path: `${__dirname}/lib-shim`, @@ -30,12 +30,7 @@ module.exports = () => { } }, target: 'node', - plugins: [ - new PreserveDynamicRequireWebpackPlugin(), - new webpack.ids.DeterministicModuleIdsPlugin({ - maxLength: 6 - }) - ], + plugins: [new PreserveDynamicRequireWebpackPlugin()], externals: [ ({ request }, callback) => { let packageName; From dd7c6353caf31b265718cc8c8b0105040a5542cf Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Thu, 20 Jun 2024 20:18:15 -0700 Subject: [PATCH 05/11] chore: update --- common/config/subspaces/build-tests-subspace/repo-state.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/subspaces/build-tests-subspace/repo-state.json b/common/config/subspaces/build-tests-subspace/repo-state.json index 5b527d9ef43..76885df9dd3 100644 --- a/common/config/subspaces/build-tests-subspace/repo-state.json +++ b/common/config/subspaces/build-tests-subspace/repo-state.json @@ -2,5 +2,5 @@ { "pnpmShrinkwrapHash": "c040a0d59aada7e1f9bdf0916df7079547de3a85", "preferredVersionsHash": "ce857ea0536b894ec8f346aaea08cfd85a5af648", - "packageJsonInjectedDependenciesHash": "4bed8c9cf98025827915ed8a55635f7afac515a6" + "packageJsonInjectedDependenciesHash": "c3f4002d2f0b3bb3cee954d68fc9fb371d7e7987" } From 71c1ae21f12af304c08fb992676e2140f2f46145 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Thu, 20 Jun 2024 21:15:13 -0700 Subject: [PATCH 06/11] fix: fallback to use commonjs --- libraries/rush-sdk/webpack.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/rush-sdk/webpack.config.js b/libraries/rush-sdk/webpack.config.js index 44607aeb5d1..9f724d7365c 100644 --- a/libraries/rush-sdk/webpack.config.js +++ b/libraries/rush-sdk/webpack.config.js @@ -18,8 +18,8 @@ module.exports = () => { mode: 'development', // So the output isn't minified devtool: 'source-map', entry: { - index: `${__dirname}/lib-esnext/index.js`, - loader: `${__dirname}/lib-esnext/loader.js` + index: `${__dirname}/lib-commonjs/index.js`, + loader: `${__dirname}/lib-commonjs/loader.js` }, output: { path: `${__dirname}/lib-shim`, From b79e3c66eebf67991bb6ee13bba66bc17bcb3e24 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Mon, 24 Jun 2024 15:48:36 -0700 Subject: [PATCH 07/11] fix: rush-sdk deep import type --- libraries/rush-sdk/src/index.ts | 2 +- libraries/rush-sdk/src/typings.d.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 libraries/rush-sdk/src/typings.d.ts diff --git a/libraries/rush-sdk/src/index.ts b/libraries/rush-sdk/src/index.ts index 4f69c81c841..aebb2dd133e 100644 --- a/libraries/rush-sdk/src/index.ts +++ b/libraries/rush-sdk/src/index.ts @@ -134,7 +134,7 @@ if (sdkContext.rushLibModule === undefined) { try { terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from rush global folder`); - const rushGlobalFolder: typeof RushGlobalFolder = new RushGlobalFolder(); + const rushGlobalFolder: RushGlobalFolder = new RushGlobalFolder(); // The path needs to keep align with the logic inside RushVersionSelector const expectedGlobalRushInstalledFolder: string = `${rushGlobalFolder.nodeSpecificPath}/rush-${rushVersion}`; terminal.writeVerboseLine( diff --git a/libraries/rush-sdk/src/typings.d.ts b/libraries/rush-sdk/src/typings.d.ts deleted file mode 100644 index 818bbcc2175..00000000000 --- a/libraries/rush-sdk/src/typings.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '@microsoft/rush-lib/lib-esnext/api/RushGlobalFolder'; From 99ff29bfb99b4c027ca13c3c3c1afe18425d5255 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Mon, 24 Jun 2024 15:48:53 -0700 Subject: [PATCH 08/11] chore: rush change --- libraries/rush-lib/package.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/rush-lib/package.json b/libraries/rush-lib/package.json index 0d191cf743b..5a879b4b43f 100644 --- a/libraries/rush-lib/package.json +++ b/libraries/rush-lib/package.json @@ -14,6 +14,13 @@ "homepage": "https://rushjs.io", "main": "lib/index.js", "typings": "dist/rush-lib.d.ts", + "typesVersions": { + "*": { + "lib-esnext/*": [ + "lib/*" + ] + } + }, "scripts": { "build": "heft build --clean", "test": "heft test --clean", From c5f0bd401ac953a25e30dec90640271477012d48 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Fri, 28 Jun 2024 12:42:55 -0700 Subject: [PATCH 09/11] chore: merge main --- .../build-tests-subspace/pnpm-lock.yaml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml b/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml index c21aeb099ad..4dceb6375f5 100644 --- a/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml +++ b/common/config/subspaces/build-tests-subspace/pnpm-lock.yaml @@ -110,10 +110,10 @@ importers: version: file:../../../apps/heft(@types/node@18.17.15) '@rushstack/heft-lint-plugin': specifier: file:../../heft-plugins/heft-lint-plugin - version: file:../../../heft-plugins/heft-lint-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15) + version: file:../../../heft-plugins/heft-lint-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15) '@rushstack/heft-typescript-plugin': specifier: file:../../heft-plugins/heft-typescript-plugin - version: file:../../../heft-plugins/heft-typescript-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15) + version: file:../../../heft-plugins/heft-typescript-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15) eslint: specifier: ~8.57.0 version: 8.57.0 @@ -6229,7 +6229,7 @@ packages: - typescript dev: true - file:../../../heft-plugins/heft-api-extractor-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15): + file:../../../heft-plugins/heft-api-extractor-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15): resolution: {directory: ../../../heft-plugins/heft-api-extractor-plugin, type: directory} id: file:../../../heft-plugins/heft-api-extractor-plugin name: '@rushstack/heft-api-extractor-plugin' @@ -6244,7 +6244,7 @@ packages: - '@types/node' dev: true - file:../../../heft-plugins/heft-jest-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15)(jest-environment-node@29.5.0): + file:../../../heft-plugins/heft-jest-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15)(jest-environment-node@29.5.0): resolution: {directory: ../../../heft-plugins/heft-jest-plugin, type: directory} id: file:../../../heft-plugins/heft-jest-plugin name: '@rushstack/heft-jest-plugin' @@ -6278,7 +6278,7 @@ packages: - ts-node dev: true - file:../../../heft-plugins/heft-lint-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15): + file:../../../heft-plugins/heft-lint-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15): resolution: {directory: ../../../heft-plugins/heft-lint-plugin, type: directory} id: file:../../../heft-plugins/heft-lint-plugin name: '@rushstack/heft-lint-plugin' @@ -6292,7 +6292,7 @@ packages: - '@types/node' dev: true - file:../../../heft-plugins/heft-typescript-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15): + file:../../../heft-plugins/heft-typescript-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15): resolution: {directory: ../../../heft-plugins/heft-typescript-plugin, type: directory} id: file:../../../heft-plugins/heft-typescript-plugin name: '@rushstack/heft-typescript-plugin' @@ -6502,7 +6502,7 @@ packages: transitivePeerDependencies: - '@types/node' - file:../../../rigs/heft-node-rig(@rushstack/heft@0.66.18)(@types/node@18.17.15): + file:../../../rigs/heft-node-rig(@rushstack/heft@0.66.19)(@types/node@18.17.15): resolution: {directory: ../../../rigs/heft-node-rig, type: directory} id: file:../../../rigs/heft-node-rig name: '@rushstack/heft-node-rig' @@ -6512,10 +6512,10 @@ packages: '@microsoft/api-extractor': file:../../../apps/api-extractor(@types/node@18.17.15) '@rushstack/eslint-config': file:../../../eslint/eslint-config(eslint@8.57.0)(typescript@5.4.5) '@rushstack/heft': file:../../../apps/heft(@types/node@18.17.15) - '@rushstack/heft-api-extractor-plugin': file:../../../heft-plugins/heft-api-extractor-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15) - '@rushstack/heft-jest-plugin': file:../../../heft-plugins/heft-jest-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15)(jest-environment-node@29.5.0) - '@rushstack/heft-lint-plugin': file:../../../heft-plugins/heft-lint-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15) - '@rushstack/heft-typescript-plugin': file:../../../heft-plugins/heft-typescript-plugin(@rushstack/heft@0.66.18)(@types/node@18.17.15) + '@rushstack/heft-api-extractor-plugin': file:../../../heft-plugins/heft-api-extractor-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15) + '@rushstack/heft-jest-plugin': file:../../../heft-plugins/heft-jest-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15)(jest-environment-node@29.5.0) + '@rushstack/heft-lint-plugin': file:../../../heft-plugins/heft-lint-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15) + '@rushstack/heft-typescript-plugin': file:../../../heft-plugins/heft-typescript-plugin(@rushstack/heft@0.66.19)(@types/node@18.17.15) '@types/heft-jest': 1.0.1 eslint: 8.57.0 jest-environment-node: 29.5.0 @@ -6535,7 +6535,7 @@ packages: dependencies: '@microsoft/api-extractor': file:../../../apps/api-extractor(@types/node@18.17.15) '@rushstack/heft': file:../../../apps/heft(@types/node@18.17.15) - '@rushstack/heft-node-rig': file:../../../rigs/heft-node-rig(@rushstack/heft@0.66.18)(@types/node@18.17.15) + '@rushstack/heft-node-rig': file:../../../rigs/heft-node-rig(@rushstack/heft@0.66.19)(@types/node@18.17.15) '@types/heft-jest': 1.0.1 '@types/node': 18.17.15 eslint: 8.57.0 From 87523b8f1557b744dffac87fc5b0f7601efede07 Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:50:15 -0700 Subject: [PATCH 10/11] prepare to release a MINOR version of Rush --- common/config/rush/version-policies.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index d5a207e4bd7..9b3a8764da7 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -103,7 +103,7 @@ "policyName": "rush", "definitionName": "lockStepVersion", "version": "5.129.6", - "nextBump": "patch", + "nextBump": "minor", "mainProject": "@microsoft/rush" } ] From 1de1d12ba1264b98f12bf83bfaeee14606cf4fc7 Mon Sep 17 00:00:00 2001 From: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:59:26 -0700 Subject: [PATCH 11/11] rush update --- common/config/subspaces/build-tests-subspace/repo-state.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/subspaces/build-tests-subspace/repo-state.json b/common/config/subspaces/build-tests-subspace/repo-state.json index 6de6f76dda5..5f991137dbc 100644 --- a/common/config/subspaces/build-tests-subspace/repo-state.json +++ b/common/config/subspaces/build-tests-subspace/repo-state.json @@ -2,5 +2,5 @@ { "pnpmShrinkwrapHash": "00e9bb9c23e93f1cf44e5989a201680d8a857644", "preferredVersionsHash": "ce857ea0536b894ec8f346aaea08cfd85a5af648", - "packageJsonInjectedDependenciesHash": "3ad79132b166303fafa8efbd2fabd5055f1fe7f6" + "packageJsonInjectedDependenciesHash": "bc9ec80f2538e316952305db6449bf0c8cd35bf6" }