Skip to content

Commit 12d1918

Browse files
authored
chore: upgrade Node.js to 20 (#2701)
* test: fix ESM-checking test * chore: upgrade Node.js to 20 * Revert "test: fix ESM-checking test" This reverts commit 0ed4acb. * update assertion * update snapshot
1 parent d9ee06a commit 12d1918

File tree

7 files changed

+51
-15
lines changed

7 files changed

+51
-15
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v3
15-
- name: Use Node.js 20
15+
- name: Use Node.js 22
1616
uses: actions/setup-node@v3
1717
with:
18-
node-version: 20
18+
node-version: 22
1919
cache: yarn
2020
- name: Install dependencies
2121
run: yarn --frozen-lockfile
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
strategy:
2929
matrix:
30-
node-version: [18, 20]
30+
node-version: [20, 22]
3131
steps:
3232
- uses: actions/checkout@v3
3333
- name: Use Node.js ${{ matrix.node-version }}
@@ -44,7 +44,7 @@ jobs:
4444
name: E2E Tests
4545
strategy:
4646
matrix:
47-
node-version: [18, 20]
47+
node-version: [20, 22]
4848
os: [ubuntu-latest, macos-latest]
4949
runs-on: ${{ matrix.os }}
5050
defaults:

__e2e__/__snapshots__/config.test.ts.snap

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,36 @@ exports[`shows up current config without unnecessary output 1`] = `
55
"root": "<<REPLACED_ROOT>>/TestProject",
66
"reactNativePath": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native",
77
"reactNativeVersion": "<<REPLACED>>",
8-
"dependencies": {},
8+
"dependencies": {
9+
"react-native-safe-area-context": {
10+
"root": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native-safe-area-context",
11+
"name": "react-native-safe-area-context",
12+
"platforms": {
13+
"ios": {
14+
"podspecPath": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native-safe-area-context/react-native-safe-area-context.podspec",
15+
"version": "5.6.1",
16+
"configurations": [],
17+
"scriptPhases": []
18+
},
19+
"android": {
20+
"sourceDir": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native-safe-area-context/android",
21+
"packageImportPath": "import com.th3rdwave.safeareacontext.SafeAreaContextPackage;",
22+
"packageInstance": "new SafeAreaContextPackage()",
23+
"buildTypes": [],
24+
"libraryName": "safeareacontext",
25+
"componentDescriptors": [
26+
"RNCSafeAreaProviderComponentDescriptor",
27+
"RNCSafeAreaViewComponentDescriptor"
28+
],
29+
"cmakeListsPath": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native-safe-area-context/android/src/main/jni/CMakeLists.txt",
30+
"cxxModuleCMakeListsModuleName": null,
31+
"cxxModuleCMakeListsPath": null,
32+
"cxxModuleHeaderName": null,
33+
"isPureCxxDependency": false
34+
}
35+
}
36+
}
37+
},
938
"commands": [
1039
{
1140
"name": "bundle",

__e2e__/config.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ test('should fail if using require() in ES module in react-native.config.mjs', (
199199
'test-command-esm',
200200
]);
201201
expect(stderr).toMatch('error Failed to load configuration of your project');
202-
expect(stdout).toMatch(
203-
'ReferenceError: require is not defined in ES module scope, you can use import instead',
204-
);
202+
expect(stdout).toMatch(/Cannot require\(\) ES Module/);
205203
});
206204

207205
test('should fail if using require() in ES module with "type": "module" in package.json', () => {

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@react-native-community/eslint-config": "^3.2.0",
3131
"@types/glob": "^7.1.1",
3232
"@types/jest": "^26.0.15",
33-
"@types/node": "^18.0.0",
33+
"@types/node": "^20.0.0",
3434
"babel-jest": "^26.6.2",
3535
"babel-plugin-module-resolver": "^3.2.0",
3636
"chalk": "^4.1.2",
@@ -55,9 +55,6 @@
5555
"string-length": "^2.0.0",
5656
"typescript": "^5.2.0"
5757
},
58-
"resolutions": {
59-
"@types/node": "^18.0.0"
60-
},
6158
"lint-staged": {
6259
"./packages/**/*.ts": [
6360
"yarn lint"

packages/cli-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"devDependencies": {
2222
"@react-native-community/cli-types": "20.0.1",
2323
"@types/mime": "^2.0.1",
24-
"@types/node": "^18.0.0",
24+
"@types/node": "^20.0.0",
2525
"@types/prompts": "^2.4.4",
2626
"@types/shell-quote": "^1.7.1"
2727
},

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"engineStrict": true,
2020
"engines": {
21-
"node": ">=18"
21+
"node": ">=20.19.4"
2222
},
2323
"jest": {
2424
"testEnvironment": "node"

yarn.lock

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,13 +2236,20 @@
22362236
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6"
22372237
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
22382238

2239-
"@types/node@*", "@types/node@^18.0.0":
2239+
"@types/node@*":
22402240
version "18.19.31"
22412241
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.31.tgz#b7d4a00f7cb826b60a543cebdbda5d189aaecdcd"
22422242
integrity sha512-ArgCD39YpyyrtFKIqMDvjz79jto5fcI/SVUs2HwB+f0dAzq68yqOdyaSivLiLugSziTpNXLQrVb7RZFmdZzbhA==
22432243
dependencies:
22442244
undici-types "~5.26.4"
22452245

2246+
"@types/node@^20.0.0":
2247+
version "20.19.11"
2248+
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.11.tgz#728cab53092bd5f143beed7fbba7ba99de3c16c4"
2249+
integrity sha512-uug3FEEGv0r+jrecvUUpbY8lLisvIjg6AAic6a2bSP5OEOLeJsDSnvhCDov7ipFFMXS3orMpzlmi0ZcuGkBbow==
2250+
dependencies:
2251+
undici-types "~6.21.0"
2252+
22462253
"@types/normalize-package-data@^2.4.0":
22472254
version "2.4.0"
22482255
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
@@ -10330,6 +10337,11 @@ undici-types@~5.26.4:
1033010337
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
1033110338
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
1033210339

10340+
undici-types@~6.21.0:
10341+
version "6.21.0"
10342+
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb"
10343+
integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==
10344+
1033310345
unicode-canonical-property-names-ecmascript@^2.0.0:
1033410346
version "2.0.0"
1033510347
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"

0 commit comments

Comments
 (0)