Skip to content

Commit 7459992

Browse files
authored
chore: switch to node 22, npm 10 (#1144)
## High Level Overview of Change This PR updates the Explorer to use Node v22 and npm v10 (it currently uses Node v18 and npm v9). ### Context of Change Node 18 security support [ends in a month](https://endoflife.date/nodejs). ### Type of Change - [x] Refactor (non-breaking change that only restructures code) ### TypeScript/Hooks Update N/A ## Test Plan CI passes. Note: technically this PR doesn't pass the required tests, but those tests should be changed to match these once this PR gets approval. ## Future Tasks Update the deploy scripts accordingly.
1 parent 3136d91 commit 7459992

File tree

5 files changed

+61
-73
lines changed

5 files changed

+61
-73
lines changed

.github/workflows/nodejs.yml

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
4-
name: Node.js CI
1+
name: Explorer CI
52

63
on:
74
push:
85
branches: [main, staging]
96
pull_request:
107
workflow_dispatch:
118

9+
env:
10+
NODE_VERSION: 22.x
11+
1212
jobs:
1313
lint:
1414
runs-on: ubuntu-latest
1515

16-
strategy:
17-
matrix:
18-
node-version: [18.x]
19-
2016
steps:
2117
- uses: actions/checkout@v4
22-
- name: Use Node.js ${{ matrix.node-version }}
18+
- name: Use Node.js ${{ env.NODE_VERSION }}
2319
uses: actions/setup-node@v4
2420
with:
25-
node-version: ${{ matrix.node-version }}
21+
node-version: ${{ env.NODE_VERSION }}
2622

2723
- name: Cache node modules
2824
id: cache-nodemodules
@@ -32,10 +28,10 @@ jobs:
3228
with:
3329
# caching node_modules
3430
path: node_modules
35-
key: ${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
31+
key: ${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
3632
restore-keys: |
37-
${{ matrix.node-version }}-build-${{ env.cache-name }}-
38-
${{ matrix.node-version }}-build-
33+
${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-
34+
${{ env.NODE_VERSION }}-build-
3935
4036
- name: Install Dependencies
4137
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
@@ -46,16 +42,12 @@ jobs:
4642
test:
4743
runs-on: ubuntu-latest
4844

49-
strategy:
50-
matrix:
51-
node-version: [18.x]
52-
5345
steps:
5446
- uses: actions/checkout@v4
55-
- name: Use Node.js ${{ matrix.node-version }}
47+
- name: Use Node.js ${{ env.NODE_VERSION }}
5648
uses: actions/setup-node@v4
5749
with:
58-
node-version: ${{ matrix.node-version }}
50+
node-version: ${{ env.NODE_VERSION }}
5951

6052
- name: Cache node modules
6153
id: cache-nodemodules
@@ -65,10 +57,10 @@ jobs:
6557
with:
6658
# caching node_modules
6759
path: node_modules
68-
key: ${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
60+
key: ${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
6961
restore-keys: |
70-
${{ matrix.node-version }}-build-${{ env.cache-name }}-
71-
${{ matrix.node-version }}-build-
62+
${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-
63+
${{ env.NODE_VERSION }}-build-
7264
7365
- name: Install Dependencies
7466
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
@@ -86,16 +78,12 @@ jobs:
8678
build:
8779
runs-on: ubuntu-latest
8880

89-
strategy:
90-
matrix:
91-
node-version: [18.x]
92-
9381
steps:
9482
- uses: actions/checkout@v4
95-
- name: Use Node.js ${{ matrix.node-version }}
83+
- name: Use Node.js ${{ env.NODE_VERSION }}
9684
uses: actions/setup-node@v4
9785
with:
98-
node-version: ${{ matrix.node-version }}
86+
node-version: ${{ env.NODE_VERSION }}
9987

10088
- name: Cache node modules
10189
id: cache-nodemodules
@@ -105,10 +93,10 @@ jobs:
10593
with:
10694
# caching node_modules
10795
path: node_modules
108-
key: ${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
96+
key: ${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
10997
restore-keys: |
110-
${{ matrix.node-version }}-build-${{ env.cache-name }}-
111-
${{ matrix.node-version }}-build-
98+
${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-
99+
${{ env.NODE_VERSION }}-build-
112100
113101
- name: Install Dependencies
114102
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
@@ -119,16 +107,12 @@ jobs:
119107
typescript-check:
120108
runs-on: ubuntu-latest
121109

122-
strategy:
123-
matrix:
124-
node-version: [18.x]
125-
126110
steps:
127111
- uses: actions/checkout@v4
128-
- name: Use Node.js ${{ matrix.node-version }}
112+
- name: Use Node.js ${{ env.NODE_VERSION }}
129113
uses: actions/setup-node@v4
130114
with:
131-
node-version: ${{ matrix.node-version }}
115+
node-version: ${{ env.NODE_VERSION }}
132116

133117
- name: Cache node modules
134118
id: cache-nodemodules
@@ -138,10 +122,10 @@ jobs:
138122
with:
139123
# caching node_modules
140124
path: node_modules
141-
key: ${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
125+
key: ${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
142126
restore-keys: |
143-
${{ matrix.node-version }}-build-${{ env.cache-name }}-
144-
${{ matrix.node-version }}-build-
127+
${{ env.NODE_VERSION }}-build-${{ env.cache-name }}-
128+
${{ env.NODE_VERSION }}-build-
145129
146130
- name: Install Dependencies
147131
if: steps.cache-nodemodules.outputs.cache-hit != 'true'

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.12.1
1+
v22.14.0

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ This project uses [Vite](https://vitejs.dev/). You can find information about ho
88

99
### Install Node and NPM
1010

11-
The project requires node@18.12.x. Follow installation instructions on [nodejs.org](https://nodejs.org/en/).
11+
The project requires node@22. Follow installation instructions on [nodejs.org](https://nodejs.org/en/).
1212

1313
(Recommended) Install using [nvm](https://github.com/nvm-sh/nvm).
1414

1515
Make sure to use npm version 8+ by running `npm install -g npm@latest` after you install Node.
1616

1717
### Google BigQuery Setup
18+
1819
This setup is required for the Tokens page of the explorer to function:
1920

2021
1. [Select or create a Cloud Platform project][projects].
2122
1. [Enable the Google BigQuery API][enable_api].
2223
1. [Set up authentication with a service account][auth]
2324

2425
Once you have completed these steps and generated the JSON key file, you must populate the following environment variables in the .env file with their corresponding values from the JSON key file:
26+
2527
```
2628
GOOGLE_APP_PROJECT_ID=your-project-id
2729
GOOGLE_APP_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\n...
@@ -34,11 +36,12 @@ GOOGLE_APP_CLIENT_EMAIL=your-client-email
3436

3537
## Install, compile, and run
3638

37-
* `npm install` then
38-
* `npm start` for development mode, or
39-
* `npm run build` then `npm run prod-server` for production mode
39+
- `npm install` then
40+
- `npm start` for development mode, or
41+
- `npm run build` then `npm run prod-server` for production mode
4042

4143
### Installing on Apple Silicon
44+
4245
Since `canvas` does not provide pre-built binaries for Apple chips during `npm install` it will try to compile it manually. To get this to succeed you need to install several dependencies by following the instructions [here](https://github.com/Automattic/node-canvas#compiling).
4346

4447
## Running on Parallel Networks
@@ -57,9 +60,9 @@ Since `canvas` does not provide pre-built binaries for Apple chips during `npm i
5760

5861
### Run unit tests
5962

60-
* Run tests in watch mode `npm test`
61-
* Run test to produce coverage `npm run test:coverage`
62-
* To open coverage HTML report in app root do `open coverage/index.html`
63+
- Run tests in watch mode `npm test`
64+
- Run test to produce coverage `npm run test:coverage`
65+
- To open coverage HTML report in app root do `open coverage/index.html`
6366

6467
### Debugging Unit Tests in Chrome
6568

@@ -84,20 +87,21 @@ Since `canvas` does not provide pre-built binaries for Apple chips during `npm i
8487
1. US English (default)
8588
1. Spanish
8689
1. French
87-
1. Japanese
88-
1. Korean
90+
1. Japanese
91+
1. Korean
8992

9093
When updating translation entires or adding new languages consult the guide [Translating](./docs/translating.md).
9194

9295
## Additional Documentation
93-
* [How to define transactions](./src/containers/shared/components/Transaction/README.md)
94-
* [Routing](./docs/routing.md)
96+
97+
- [How to define transactions](./src/containers/shared/components/Transaction/README.md)
98+
- [Routing](./docs/routing.md)
9599

96100
## React Documentation
97101

98-
* Latest news in [react blog](https://reactjs.org/blog)
99-
* [React documentation](https://reactjs.org/docs)
100-
* [How to think in react](https://reactjs.org/docs/thinking-in-react.html) and break down components
102+
- Latest news in [react blog](https://reactjs.org/blog)
103+
- [React documentation](https://reactjs.org/docs)
104+
- [How to think in react](https://reactjs.org/docs/thinking-in-react.html) and break down components
101105

102106
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=bigquery.googleapis.com
103107
[projects]: https://console.cloud.google.com/project

package-lock.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@types/enzyme": "^3.10.12",
5959
"@types/jest": "^26.0.24",
6060
"@types/lodash": "^4.17.6",
61-
"@types/node": "^18.19.33",
61+
"@types/node": "^22.14.0",
6262
"@types/react": "^17.0.39",
6363
"@types/react-dom": "^17.0.9",
6464
"@typescript-eslint/eslint-plugin": "^7.0.0",
@@ -139,7 +139,7 @@
139139
],
140140
"prettier": "@xrplf/prettier-config",
141141
"engines": {
142-
"node": ">=18.0.0 <19",
142+
"node": ">=22.0.0 <23",
143143
"npm": ">=9.0.0 <11.0.0"
144144
}
145145
}

0 commit comments

Comments
 (0)