Skip to content

Commit 706afda

Browse files
committed
feat: support React 18 and 19 via peer dependencies
Widen peerDependencies from "^19" to "^18 || ^19" for react and react-dom in eds-core-react, eds-lab-react, eds-data-grid-react, and eds-utils. Add CI workflow to verify React 18 compatibility on PRs. Verified locally: build, typecheck, and all 684 tests pass with React 18.
1 parent fd75da0 commit 706afda

5 files changed

Lines changed: 59 additions & 8 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: React 18 compatibility
2+
permissions:
3+
contents: read
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
paths:
9+
- 'packages/**'
10+
11+
jobs:
12+
setup:
13+
uses: ./.github/workflows/_setup.yml
14+
secrets: inherit
15+
with:
16+
cacheKey: ${{ github.sha }}-react18
17+
checkout_paths: packages apps scripts .github
18+
react18:
19+
name: Build & test with React 18
20+
runs-on: ubuntu-latest
21+
needs: setup
22+
steps:
23+
- name: Use "setup" cache
24+
id: setup-cache
25+
uses: actions/cache@v5
26+
with:
27+
path: |
28+
./*
29+
~/.pnpm-store
30+
key: ${{ github.sha }}-react18
31+
- name: Fallback checkout (cache miss)
32+
if: steps.setup-cache.outputs.cache-hit != 'true'
33+
uses: actions/checkout@v6
34+
- name: Install Node.js
35+
uses: actions/setup-node@v6
36+
with:
37+
node-version: '22.12.0'
38+
- name: Setup pnpm
39+
uses: pnpm/action-setup@v4
40+
- name: Fallback install (cache miss)
41+
if: steps.setup-cache.outputs.cache-hit != 'true'
42+
run: pnpm install
43+
- name: Override to React 18
44+
run: |
45+
pnpm add -Dw react@18 react-dom@18 @types/react@18 @types/react-dom@18
46+
- name: Build packages
47+
run: pnpm run build
48+
- name: Test packages
49+
run: pnpm run test
50+
- name: Type check packages
51+
run: pnpm run types

packages/eds-core-react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
"typescript": "^5.9.3"
9696
},
9797
"peerDependencies": {
98-
"react": "^19",
99-
"react-dom": "^19",
98+
"react": "^18 || ^19",
99+
"react-dom": "^18 || ^19",
100100
"styled-components": "^6"
101101
},
102102
"dependencies": {

packages/eds-data-grid-react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
},
3232
"peerDependencies": {
3333
"@equinor/eds-core-react": ">=1 <3",
34-
"react": "^19",
35-
"react-dom": "^19",
34+
"react": "^18 || ^19",
35+
"react-dom": "^18 || ^19",
3636
"styled-components": "^6"
3737
},
3838
"dependencies": {

packages/eds-lab-react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
"typescript": "^5.9.3"
8787
},
8888
"peerDependencies": {
89-
"react": "^19",
90-
"react-dom": "^19",
89+
"react": "^18 || ^19",
90+
"react-dom": "^18 || ^19",
9191
"styled-components": "^6"
9292
},
9393
"dependencies": {

packages/eds-utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
"@vitejs/plugin-react": "^5.1.4"
7878
},
7979
"peerDependencies": {
80-
"react": "^19",
81-
"react-dom": "^19",
80+
"react": "^18 || ^19",
81+
"react-dom": "^18 || ^19",
8282
"styled-components": "^6"
8383
},
8484
"dependencies": {

0 commit comments

Comments
 (0)