Skip to content

Commit

Permalink
Breaking - Bump minimum Node version from 14 to 16 (#36217)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #36217

## Bump minimum Node JS version to 16 via `react-native/package.json#engines`
In #35443 we stopped running CI in Node 14 - this follows up by formally making Node 16 the minimum supported version ahead of the 0.72 cut.

Node 14 [ends maintenance releases in April](https://github.com/nodejs/release#release-schedule), and bumping this minimum will allow other associated Node JS tools (CLI, Metro, Jest) to reduce their support burden.

## Insert `engines` into `template/package.json`
The constraint at `react-native/package.json#engines` ensures the minimum at install/init time, with package managers providing an actionable error or warning if the constraint is not met. However, it doesn't help guide users to a supported version if on an existing project they run (e.g.) `yarn start`.

Adding a constraint to the template helps prevent accidental use of an older version, as well as providing a clear reference for the current minimum.

Insertion of `engines` below existing `package.json` fields is consistent with [`sort-package-json`](https://github.com/keithamus/sort-package-json/blob/main/defaultRules.md) and [`prettier-package-json`](https://github.com/cameronhunter/prettier-package-json/blob/main/src/defaultOptions.ts) - and keeps it out of the way of fields RN developers are likely to be more concerned about.

## Docs PR
facebook/react-native-website#3580

## Changelog:
[General][Breaking] Bump minimum Node JS version to 16

Reviewed By: jacdebug

Differential Revision: D43436883

fbshipit-source-id: 0b369487fe44fe777e6fedc2299973a5fddd06b2
  • Loading branch information
robhogan authored and facebook-github-bot committed Feb 20, 2023
1 parent a80578a commit afc91de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"repository": "github:facebook/react-native",
"engines": {
"node": ">=14"
"node": ">=16"
},
"types": "types",
"jest-junit": {
Expand Down
3 changes: 3 additions & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},
"engines": {
"node": ">=16"
}
}

0 comments on commit afc91de

Please sign in to comment.