diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0704ee2e819..b4715a50f4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,12 @@ jobs: include: - NodeVersion: 14 OS: ubuntu-latest - - NodeVersion: 16 + - NodeVersion: 18 OS: ubuntu-latest - NodeVersion: 16 OS: windows-latest + - NodeVersion: 18 + OS: windows-latest name: Node.js v${{ matrix.NodeVersion }} (${{ matrix.OS }}) runs-on: ${{ matrix.OS }} steps: @@ -33,6 +35,12 @@ jobs: with: node-version: ${{ matrix.NodeVersion }} + # Workaround for Node 18 incompatibility with Webpack 4 + - name: Enable Webpack 4 workaround + shell: bash + run: echo "NODE_OPTIONS=--openssl-legacy-provider" >> "$GITHUB_ENV" + if: matrix.NodeVersion == 18 + - name: Verify Change Logs run: node common/scripts/install-run-rush.js change --verify @@ -50,11 +58,18 @@ jobs: # See https://github.com/microsoft/rushstack/issues/2981 BROWSERSLIST_IGNORE_OLD_DATA: 1 + - name: Ensure repo README is up-to-date + run: node repo-scripts/repo-toolbox/lib/start.js readme --verify + - name: Rush test (rush-lib) run: node apps/rush/lib/start-dev.js test --verbose --production --timeline env: # Prevent time-based browserslist update warning # See https://github.com/microsoft/rushstack/issues/2981 BROWSERSLIST_IGNORE_OLD_DATA: 1 - - name: Ensure repo README is up-to-date - run: node repo-scripts/repo-toolbox/lib/start.js readme --verify + + # One of the post run actions apparently uses older Node.js that rejects --openssl-legacy-provider + - name: Revert Webpack 4 workaround + shell: bash + run: echo "NODE_OPTIONS=" >> "$GITHUB_ENV" + if: matrix.NodeVersion == 18 diff --git a/.gitignore b/.gitignore index c13c653a873..20b4d3f42c6 100644 --- a/.gitignore +++ b/.gitignore @@ -63,19 +63,20 @@ jspm_packages/ .idea/ *.iml -# Visual Studio Code -.vscode - # Rush temporary files common/deploy/ common/temp/ common/autoinstallers/*/.npmrc **/.rush/temp/ +*.lock # Heft temporary files .cache .heft +# Visual Studio Code +.vscode + # Common toolchain intermediate files temp lib diff --git a/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-49.json b/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-49.json new file mode 100644 index 00000000000..3d63a489b83 --- /dev/null +++ b/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-49.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Update Node.js version checks to support the new LTS release", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-50.json b/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-50.json new file mode 100644 index 00000000000..9dbb12a9945 --- /dev/null +++ b/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-50.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Update \"rush init\" template to use PNPM 7.33.5", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-51.json b/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-51.json new file mode 100644 index 00000000000..f53b74ba862 --- /dev/null +++ b/common/changes/@microsoft/rush/octogonz-node-18_2023-08-11-18-51.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Update the \"rush init\" template's .gitignore to avoid spurious diffs for files such as \"autoinstaller.lock\"", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/common/changes/@rushstack/heft-webpack4-plugin/octogonz-node-18_2023-08-11-18-32.json b/common/changes/@rushstack/heft-webpack4-plugin/octogonz-node-18_2023-08-11-18-32.json new file mode 100644 index 00000000000..dedb49067b3 --- /dev/null +++ b/common/changes/@rushstack/heft-webpack4-plugin/octogonz-node-18_2023-08-11-18-32.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-webpack4-plugin", + "comment": "Display a warning if Node.js 17 or newer is used without the \"--openssl-legacy-provider\" workaround", + "type": "minor" + } + ], + "packageName": "@rushstack/heft-webpack4-plugin" +} \ No newline at end of file diff --git a/heft-plugins/heft-webpack4-plugin/src/Webpack4Plugin.ts b/heft-plugins/heft-webpack4-plugin/src/Webpack4Plugin.ts index d74fc15e186..f951c303c10 100644 --- a/heft-plugins/heft-webpack4-plugin/src/Webpack4Plugin.ts +++ b/heft-plugins/heft-webpack4-plugin/src/Webpack4Plugin.ts @@ -184,11 +184,37 @@ export default class Webpack4Plugin implements IHeftTaskPlugin 16) { + // Match strings like this: + // "--max-old-space-size=4096 --openssl-legacy-provider" + // "--openssl-legacy-provider=true" + // Do not accidentally match strings like this: + // "--openssl-legacy-provider-unrelated" + // "---openssl-legacy-provider" + if (!/(^|[^a-z\-])--openssl-legacy-provider($|[^a-z\-])/.test(process.env.NODE_OPTIONS ?? '')) { + taskSession.logger.emitWarning( + new Error( + `Node.js ${nodejsMajorVersion} is incompatible with Webpack 4. To work around this problem, use the environment variable NODE_OPTIONS="--openssl-legacy-provider"` + ) + ); + } + } + } else { + taskSession.logger.emitWarning(new Error(`Unable to parse Node.js version "${process.versions.node}"`)); + } + } + private async _runWebpackAsync( taskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration, options: IWebpackPluginOptions ): Promise { + this._warnAboutNodeJsIncompatibility(taskSession); + this._validateEnvironmentVariable(taskSession); if (taskSession.parameters.watch || this._isServeMode) { // Should never happen, but just in case @@ -236,6 +262,8 @@ export default class Webpack4Plugin implements IHeftTaskPlugin void ): Promise { + this._warnAboutNodeJsIncompatibility(taskSession); + // Save a handle to the original promise, since the this-scoped promise will be replaced whenever // the compilation completes. let webpackCompilationDonePromise: Promise | undefined = this._webpackCompilationDonePromise; diff --git a/libraries/rush-lib/assets/rush-init/[dot]gitignore b/libraries/rush-lib/assets/rush-init/[dot]gitignore index 41e850bba07..531395c0124 100644 --- a/libraries/rush-lib/assets/rush-init/[dot]gitignore +++ b/libraries/rush-lib/assets/rush-init/[dot]gitignore @@ -68,6 +68,8 @@ common/deploy/ common/temp/ common/autoinstallers/*/.npmrc **/.rush/temp/ +*.lock # Heft temporary files +.cache .heft diff --git a/libraries/rush-lib/assets/rush-init/rush.json b/libraries/rush-lib/assets/rush-init/rush.json index 12012e5c9f5..c7edd4d0610 100644 --- a/libraries/rush-lib/assets/rush-init/rush.json +++ b/libraries/rush-lib/assets/rush-init/rush.json @@ -26,7 +26,7 @@ * Specify one of: "pnpmVersion", "npmVersion", or "yarnVersion". See the Rush documentation * for details about these alternatives. */ - "pnpmVersion": "6.7.1", + "pnpmVersion": "7.33.5", /*[LINE "HYPOTHETICAL"]*/ "npmVersion": "6.14.15", /*[LINE "HYPOTHETICAL"]*/ "yarnVersion": "1.9.4", diff --git a/libraries/rush-lib/src/logic/NodeJsCompatibility.ts b/libraries/rush-lib/src/logic/NodeJsCompatibility.ts index 1010e1f4554..08176aed5bf 100644 --- a/libraries/rush-lib/src/logic/NodeJsCompatibility.ts +++ b/libraries/rush-lib/src/logic/NodeJsCompatibility.ts @@ -15,7 +15,7 @@ import type { RushConfiguration } from '../api/RushConfiguration'; * LTS schedule: https://nodejs.org/en/about/releases/ * LTS versions: https://nodejs.org/en/download/releases/ */ -const UPCOMING_NODE_LTS_VERSION: number = 18; +const UPCOMING_NODE_LTS_VERSION: number = 20; const nodeVersion: string = process.versions.node; const nodeMajorVersion: number = semver.major(nodeVersion); diff --git a/rush.json b/rush.json index 6bceeeb8b72..298365cc70e 100644 --- a/rush.json +++ b/rush.json @@ -26,7 +26,7 @@ * Specify one of: "pnpmVersion", "npmVersion", or "yarnVersion". See the Rush documentation * for details about these alternatives. */ - "pnpmVersion": "7.26.1", + "pnpmVersion": "7.33.5", // "npmVersion": "6.14.15", // "yarnVersion": "1.9.4", @@ -42,7 +42,7 @@ * LTS schedule: https://nodejs.org/en/about/releases/ * LTS versions: https://nodejs.org/en/download/releases/ */ - "nodeSupportedVersionRange": ">=14.15.0 <15.0.0 || >=16.13.0 <17.0.0", + "nodeSupportedVersionRange": ">=14.15.0 <15.0.0 || >=16.13.0 <17.0.0 || >=18.15.0 <19.0.0", /** * If the version check above fails, Rush will display a message showing the current