Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] Add support for Node.js 18.x LTS #3940

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Update \"rush init\" and version checks to reflect that Node.js 18.x is now the Long Term Support (LTS) release series",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
2 changes: 2 additions & 0 deletions common/config/azure-pipelines/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
NodeVersion: 14
'NodeJs 16':
NodeVersion: 16
'NodeJs 18':
NodeVersion: 18

steps:
- checkout: self
Expand Down
2 changes: 1 addition & 1 deletion common/config/azure-pipelines/npm-publish-rush.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pool:
vmImage: 'ubuntu-latest'
variables:
- name: NodeVersion
value: 14
value: 18
- name: FORCE_COLOR
value: 1
- name: SourceBranch
Expand Down
2 changes: 1 addition & 1 deletion common/config/azure-pipelines/npm-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pool:
vmImage: 'ubuntu-latest'
variables:
- name: NodeVersion
value: 14
value: 18
- name: FORCE_COLOR
value: 1
- name: SourceBranch
Expand Down
2 changes: 1 addition & 1 deletion libraries/rush-lib/assets/rush-init/rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* LTS schedule: https://nodejs.org/en/about/releases/
* LTS versions: https://nodejs.org/en/download/releases/
*/
"nodeSupportedVersionRange": ">=12.13.0 <13.0.0 || >=14.15.0 <15.0.0 || >=16.13.0 <17.0.0",
"nodeSupportedVersionRange": ">=16.13.0 <17.0.0 || >=18.12.1 <19.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you intentionally dropping support for Node 14? It's supported until 4/30/23.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikeharder This is just for the rush init template that's used when people create new Git repositories. We could wait until the last day to adjust it, but I worried that it might take us months to remember to do that. 😆 You can of course put whatever range you like in your own rush.json.

If you think it's important for some reason let me know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would err on the side of allowing older Node versions beyond EOL, rather than dropping support for active Node versions. But I agree customers can change this after rush init if they want, so it's not too important.


/**
* If the version check above fails, Rush will display a message showing the current
Expand Down
20 changes: 14 additions & 6 deletions libraries/rush-lib/src/logic/NodeJsCompatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import * as semver from 'semver';
import type { RushConfiguration } from '../api/RushConfiguration';

/**
* This constant is the major version of the next LTS node Node.js release. This constant should be updated when
* a new LTS version is added to Rush's support matrix.
* This constant is the major version of the currently active LTS node Node.js release series.
* This constant should be updated whenever a new LTS version is added to Rush's support matrix.
*
* LTS schedule: https://nodejs.org/en/about/releases/
* LTS versions: https://nodejs.org/en/download/releases/
* LTS versions: https://nodejs.org/en/download/releases/ (searchable)
*/
const UPCOMING_NODE_LTS_VERSION: number = 18;
const LATEST_NODE_LTS_VERSION: number = 18;
const nodeVersion: string = process.versions.node;
const nodeMajorVersion: number = semver.major(nodeVersion);

Expand Down Expand Up @@ -49,7 +49,7 @@ export class NodeJsCompatibility {
// IMPORTANT: If this test fails, the Rush CLI front-end process will terminate with an error.
// Only increment it when our code base is known to use newer features (e.g. "async"/"await") that
// have no hope of working with older Node.js.
if (semver.satisfies(nodeVersion, '< 8.9.0')) {
if (semver.satisfies(nodeVersion, '< 10.23.3')) {
console.error(
colors.red(
`Your version of Node.js (${nodeVersion}) is very old and incompatible with Rush. ` +
Expand Down Expand Up @@ -82,7 +82,15 @@ export class NodeJsCompatibility {
* Warn about a Node.js version that has not been tested yet with Rush.
*/
public static warnAboutVersionTooNew(options: IWarnAboutVersionTooNewOptions): boolean {
if (nodeMajorVersion >= UPCOMING_NODE_LTS_VERSION + 1) {
// For example, suppose that LATEST_NODE_LTS_VERSION=18, then the schedule might look like this:
//
// 14.x: Maintenance
// 16.x: Maintenance
// LATEST_NODE_LTS_VERSION 18.x: Active LTS
// 19.x: Current experimental odd-numbered release series
// 20.x: "Pending" release series (that will later become LTS)
// LATEST_NODE_LTS_VERSION+3 21.x: . . .
if (nodeMajorVersion >= LATEST_NODE_LTS_VERSION + 3) {
if (!options.alreadyReportedNodeTooNewError) {
// We are on a much newer release than we have tested and support
if (options.isRushLib) {
Expand Down
2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.12.1 <19.0.0",

/**
* If the version check above fails, Rush will display a message showing the current
Expand Down