From fcd630ddd97ff262868c29855a7a283dda25d496 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 16 May 2025 18:00:00 +0400 Subject: [PATCH] fix(core): remove engines field, improve compatibility documentation (#31245) --- .../nx-nodejs-typescript-version-matrix.md | 45 +++++++++++++------ .../workspace/nx-compatibility-matrix.md | 45 +++++++++++++------ packages/nx/package.json | 3 -- .../non-root/package.json__tmpl__ | 3 -- .../ts-solution/package.json__tmpl__ | 3 -- .../application/application.impl.spec.ts | 8 ---- .../files/non-root/package.json__tmpl__ | 3 -- .../files/ts-solution/package.json__tmpl__ | 3 -- 8 files changed, 62 insertions(+), 51 deletions(-) diff --git a/docs/generated/packages/workspace/documents/nx-nodejs-typescript-version-matrix.md b/docs/generated/packages/workspace/documents/nx-nodejs-typescript-version-matrix.md index c59d557684..de5ab3bb09 100644 --- a/docs/generated/packages/workspace/documents/nx-nodejs-typescript-version-matrix.md +++ b/docs/generated/packages/workspace/documents/nx-nodejs-typescript-version-matrix.md @@ -1,20 +1,37 @@ --- -title: Nx, NodeJS and TypeScript Compatibility Matrix -description: A reference table showing which versions of Node.js and TypeScript are compatible with different major versions of Nx. +title: Nx, Node.js and TypeScript Compatibility +description: A reference outlining Nx's support policy and current compatibility matrix for Node.js and TypeScript. --- -# Nx, NodeJS and TypeScript Compatibility Matrix +# Nx, Node.js and TypeScript Compatibility -Below is a reference table that matches versions the latest major versions of Nx to the version TypeScript that it uses -and the version of NodeJS that we tested it against. +## Node.js Compatibility Matrix -> _Note: Other versions of NodeJS **may** still work without issue for these versions of Nx. This table outlines the -> version of NodeJS that we used when building and testing each particular version of Nx._ +Below is a reference table that matches the most recent major versions of Nx to the versions of Node.js that they officially support, and are tested against. -| Nx Version | Node Version | Typescript Version | -| --------------- | ---------------- | ------------------ | -| 21.x (next) | 22.x, ^20.19.0, | ~5.4.2 | -| 20.x (latest) | 22.x, 20.x, 18.x | ~5.4.2 | -| 19.x (previous) | 22.x, 20.x, 18.x | ~5.4.2 | -| 18.x | 20.x, 18.x | ~5.4.2 | -| 17.x | 20.x, 18.x | ~5.1.0 | +Nx's policy is to support the LTS versions (i.e. actively maintained even numbered versions) of Node.js, but we will only remove support for older versions in a major version of Nx to avoid unexpected disruption. We may add support for newer LTS versions in a minor version of Nx as long as it would not break existing projects. + +> _Note: Other versions of Node.js **may** still work without issue for these versions of Nx. Those include versions which are already EOL, or odd version numbers (e.g. 23), which Node.js actively +> discourages using in production._ + +| Nx Version | Node Version | +| --------------- | ------------------ | +| 21.x (current) | ^22.12.0, ^20.19.0 | +| 20.x (previous) | 22.x, 20.x, 18.x | +| 19.x | 22.x, 20.x, 18.x | +| 18.x | 20.x, 18.x | + +We intentionally do not include an `"engines"` field in the `package.json` file for Nx in order to allow for user flexibility, but this page should be considered the official compatibility matrix. + +## TypeScript Compatibility + +Unlike Node.js, TypeScript's policy is not to follow semver conventions around breaking changes only coming in major versions, despite using version numbers that are semver-like. Just like with Node.js, though, we will only remove support for older versions of TypeScript in a major version of Nx to avoid unexpected disruption. We may add support for newer versions in a minor version of Nx as long as it would not break existing projects. + +| Nx Version | TypeScript Version | +| --------------- | ------------------ | +| 21.x (current) | >= 5.4.2 < 5.9.0 | +| 20.x (previous) | ~5.4.2 | +| 19.x | ~5.4.2 | +| 18.x | ~5.4.2 | + +This page will be updated from time to time to reflect the latest versions of Node.js and TypeScript that are supported. If you encounter issues with Nx, please make sure you are using a supported version of Node.js and TypeScript before filing an issue. diff --git a/docs/shared/packages/workspace/nx-compatibility-matrix.md b/docs/shared/packages/workspace/nx-compatibility-matrix.md index c59d557684..de5ab3bb09 100644 --- a/docs/shared/packages/workspace/nx-compatibility-matrix.md +++ b/docs/shared/packages/workspace/nx-compatibility-matrix.md @@ -1,20 +1,37 @@ --- -title: Nx, NodeJS and TypeScript Compatibility Matrix -description: A reference table showing which versions of Node.js and TypeScript are compatible with different major versions of Nx. +title: Nx, Node.js and TypeScript Compatibility +description: A reference outlining Nx's support policy and current compatibility matrix for Node.js and TypeScript. --- -# Nx, NodeJS and TypeScript Compatibility Matrix +# Nx, Node.js and TypeScript Compatibility -Below is a reference table that matches versions the latest major versions of Nx to the version TypeScript that it uses -and the version of NodeJS that we tested it against. +## Node.js Compatibility Matrix -> _Note: Other versions of NodeJS **may** still work without issue for these versions of Nx. This table outlines the -> version of NodeJS that we used when building and testing each particular version of Nx._ +Below is a reference table that matches the most recent major versions of Nx to the versions of Node.js that they officially support, and are tested against. -| Nx Version | Node Version | Typescript Version | -| --------------- | ---------------- | ------------------ | -| 21.x (next) | 22.x, ^20.19.0, | ~5.4.2 | -| 20.x (latest) | 22.x, 20.x, 18.x | ~5.4.2 | -| 19.x (previous) | 22.x, 20.x, 18.x | ~5.4.2 | -| 18.x | 20.x, 18.x | ~5.4.2 | -| 17.x | 20.x, 18.x | ~5.1.0 | +Nx's policy is to support the LTS versions (i.e. actively maintained even numbered versions) of Node.js, but we will only remove support for older versions in a major version of Nx to avoid unexpected disruption. We may add support for newer LTS versions in a minor version of Nx as long as it would not break existing projects. + +> _Note: Other versions of Node.js **may** still work without issue for these versions of Nx. Those include versions which are already EOL, or odd version numbers (e.g. 23), which Node.js actively +> discourages using in production._ + +| Nx Version | Node Version | +| --------------- | ------------------ | +| 21.x (current) | ^22.12.0, ^20.19.0 | +| 20.x (previous) | 22.x, 20.x, 18.x | +| 19.x | 22.x, 20.x, 18.x | +| 18.x | 20.x, 18.x | + +We intentionally do not include an `"engines"` field in the `package.json` file for Nx in order to allow for user flexibility, but this page should be considered the official compatibility matrix. + +## TypeScript Compatibility + +Unlike Node.js, TypeScript's policy is not to follow semver conventions around breaking changes only coming in major versions, despite using version numbers that are semver-like. Just like with Node.js, though, we will only remove support for older versions of TypeScript in a major version of Nx to avoid unexpected disruption. We may add support for newer versions in a minor version of Nx as long as it would not break existing projects. + +| Nx Version | TypeScript Version | +| --------------- | ------------------ | +| 21.x (current) | >= 5.4.2 < 5.9.0 | +| 20.x (previous) | ~5.4.2 | +| 19.x | ~5.4.2 | +| 18.x | ~5.4.2 | + +This page will be updated from time to time to reflect the latest versions of Node.js and TypeScript that are supported. If you encounter issues with Nx, please make sure you are using a supported version of Node.js and TypeScript before filing an issue. diff --git a/packages/nx/package.json b/packages/nx/package.json index f893bc2529..eae072dfcd 100644 --- a/packages/nx/package.json +++ b/packages/nx/package.json @@ -167,8 +167,5 @@ "x86_64-unknown-linux-musl", "x86_64-unknown-freebsd" ] - }, - "engines": { - "node": "^20.19.0 || ^22.12.0" } } diff --git a/packages/react/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ b/packages/react/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ index 30e36f47b7..4a6537f996 100644 --- a/packages/react/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ +++ b/packages/react/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ @@ -17,8 +17,5 @@ "@types/react": "<%= reactVersion %>", "@types/react-dom": "<%= reactVersion %>" }, - "engines": { - "node": ">=20" - }, "sideEffects": false } diff --git a/packages/react/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ b/packages/react/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ index c2e5f8a5f5..c697ebdd0d 100644 --- a/packages/react/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ +++ b/packages/react/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ @@ -17,8 +17,5 @@ "@types/react": "<%= reactVersion %>", "@types/react-dom": "<%= reactVersion %>" }, - "engines": { - "node": ">=20" - }, "sideEffects": false, } diff --git a/packages/remix/src/generators/application/application.impl.spec.ts b/packages/remix/src/generators/application/application.impl.spec.ts index 52e3097887..5f86d2e963 100644 --- a/packages/remix/src/generators/application/application.impl.spec.ts +++ b/packages/remix/src/generators/application/application.impl.spec.ts @@ -455,7 +455,6 @@ describe('Remix Application', () => { "private", "type", "scripts", - "engines", "sideEffects", "nx", "dependencies", @@ -477,9 +476,6 @@ describe('Remix Application', () => { "@types/react": "^18.2.0", "@types/react-dom": "^18.2.0", }, - "engines": { - "node": ">=20", - }, "name": "@proj/myapp", "nx": { "tags": [ @@ -661,7 +657,6 @@ describe('Remix Application', () => { "private", "type", "scripts", - "engines", "sideEffects", "nx", "dependencies", @@ -694,9 +689,6 @@ describe('Remix Application', () => { "@types/react": "^18.2.0", "@types/react-dom": "^18.2.0", }, - "engines": { - "node": ">=20", - }, "name": "@proj/myapp", "private": true, "scripts": {}, diff --git a/packages/remix/src/generators/application/files/non-root/package.json__tmpl__ b/packages/remix/src/generators/application/files/non-root/package.json__tmpl__ index b0d40d134e..367675dede 100644 --- a/packages/remix/src/generators/application/files/non-root/package.json__tmpl__ +++ b/packages/remix/src/generators/application/files/non-root/package.json__tmpl__ @@ -16,8 +16,5 @@ "@types/react": "<%= typesReactVersion %>", "@types/react-dom": "<%= typesReactDomVersion %>" }, - "engines": { - "node": ">=20" - }, "sideEffects": false } diff --git a/packages/remix/src/generators/application/files/ts-solution/package.json__tmpl__ b/packages/remix/src/generators/application/files/ts-solution/package.json__tmpl__ index 18a8f71e9a..92446bd4f1 100644 --- a/packages/remix/src/generators/application/files/ts-solution/package.json__tmpl__ +++ b/packages/remix/src/generators/application/files/ts-solution/package.json__tmpl__ @@ -16,8 +16,5 @@ "@types/react": "<%= typesReactVersion %>", "@types/react-dom": "<%= typesReactDomVersion %>" }, - "engines": { - "node": ">=20" - }, "sideEffects": false }