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

@W-14545340@ Add support for node 20 #1612

Merged
merged 17 commits into from
Dec 14, 2023
Merged

@W-14545340@ Add support for node 20 #1612

merged 17 commits into from
Dec 14, 2023

Conversation

wjhsf
Copy link
Contributor

@wjhsf wjhsf commented Dec 8, 2023

Description

This PR adds support for node 20/npm 10, mostly by just updating our engines to allow it. Note that Managed Runtime does not currently support node 20, so this does not validate deployed apps beyond "can be built with node 20 and executed with node 18".

As discovered in #1535, upgrading to node 20 mitigates one out of memory issue present in node itself. However, after a bit of testing, this did completely mitigate the issue.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

To test functionality:

  • install node 20 / npm 10
  • check out code
  • run every npm script in every package
  • generate extensible app
  • run every npm script in extensible app
  • generate non-extensible app
  • run every npm script in non-extensible app

To test OOM issue, start the dev server and then execute the following script from packages/template-retail-react-app. It updates a file, waits 3 seconds, then makes a request. It repeats until the app crashes or we reach 1000 iterations. Running this locally, I had the app crash after 59 iterations for node 18 and 69 iterations for node 20.

for i in $(seq 1 1000); do
  echo "// $i" >> app/constants.js
  sleep 3
  code=`curl -sSI -o /dev/null -w "%{http_code}" http://localhost:3000` || break
  echo "$i: $code"
done

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@wjhsf wjhsf requested a review from a team as a code owner December 8, 2023 20:28
Copy link
Collaborator

@adamraya adamraya left a comment

Choose a reason for hiding this comment

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

Changes to engines are missing in -lock.json files.

"engines": {
"node": "^16.11.0 || ^18.0.0",
"npm": "^8.0.0 || ^9.0.0"
}

@wjhsf wjhsf enabled auto-merge (squash) December 11, 2023 19:36
@wjhsf wjhsf requested review from adamraya and a team December 11, 2023 20:36
Comment on lines -6 to -7
"node": "^16.0.0 || ^18.0.0",
"npm": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we define only Node 18 and Node 20 on a generated project, while we define Node 16, Node 18, and Node 20 in monorepo packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to break existing projects, if we have any customers who are still using node 16 for local development. (Which would be weird, but technically possible.) For newly generated projects, though, we don't have to worry about supporting legacy versions!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good. I thought that was the case, in theory dropping Node 16 would be a breaking change.

@wjhsf wjhsf requested review from adamraya and a team December 11, 2023 21:52
Copy link
Collaborator

@adamraya adamraya left a comment

Choose a reason for hiding this comment

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

LGTM!
I smoke-tested the generated template-retail-react-app project using Node 20 locally and things work as expected.
I don't see new warnings or errors when running npm i locally using Node 20.

@wjhsf
Copy link
Contributor Author

wjhsf commented Dec 12, 2023

Fixes #1618.

@wjhsf wjhsf merged commit 5609322 into develop Dec 14, 2023
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants