Skip to content

Commit 8d5d5d5

Browse files
authored
chore: Default to React 19 (#8296)
* chore: Default to React 19 * fix * fix
1 parent 8c33cba commit 8d5d5d5

File tree

7 files changed

+118
-107
lines changed

7 files changed

+118
-107
lines changed

.circleci/comment.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ async function run() {
7979
body: `Build successful! 🎉
8080
8181
* [View the storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook/index.html)
82-
* [View the storybook-19](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-19/index.html)
83-
* [View the storybook-17](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-17/index.html)
84-
* [View the storybook-16](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-16/index.html)
8582
* [View the S2 storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-s2/index.html)
8683
* [View the documentation](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/docs/index.html)`
8784
});

.circleci/config.yml

Lines changed: 80 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
- ~/react-spectrum
105105
key: react-spectrum17-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
106106

107-
install-19:
107+
install-18:
108108
executor: rsp-large
109109
steps:
110110
- checkout
@@ -119,12 +119,34 @@ jobs:
119119
- run:
120120
name: build
121121
command: |
122-
yarn install --immutable && yarn install-19
122+
yarn install --immutable && yarn install-18
123123
124124
- save_cache:
125125
paths:
126126
- ~/react-spectrum
127-
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
127+
key: react-spectrum-18-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
128+
129+
install-canary:
130+
executor: rsp-large
131+
steps:
132+
- checkout
133+
134+
- run:
135+
name: Write npmrc
136+
command: |
137+
if [ $NPM_PASSWORD ]; then
138+
cp .circleci/.npmrc .npmrc
139+
fi
140+
141+
- run:
142+
name: build
143+
command: |
144+
yarn install --immutable && yarn install-canary
145+
146+
- save_cache:
147+
paths:
148+
- ~/react-spectrum
149+
key: react-spectrum-canary-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
128150

129151
test-ssr:
130152
executor: rsp-xlarge
@@ -184,11 +206,22 @@ jobs:
184206
command: |
185207
yarn test:ssr
186208
187-
test-ssr-19:
209+
test-ssr-18:
210+
executor: rsp-xlarge
211+
steps:
212+
- restore_cache:
213+
key: react-spectrum-18-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
214+
215+
- run:
216+
name: test ssr
217+
command: |
218+
yarn test:ssr
219+
220+
test-ssr-canary:
188221
executor: rsp-xlarge
189222
steps:
190223
- restore_cache:
191-
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
224+
key: react-spectrum-canary-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
192225

193226
- run:
194227
name: test ssr
@@ -243,12 +276,12 @@ jobs:
243276
- store_artifacts:
244277
path: ~/junit
245278

246-
test-19:
279+
test-18:
247280
parallelism: 3
248281
executor: rsp-xlarge
249282
steps:
250283
- restore_cache:
251-
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
284+
key: react-spectrum-18-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
252285

253286
- run: mkdir ~/junit
254287

@@ -257,10 +290,34 @@ jobs:
257290
command: |
258291
shopt -s globstar
259292
TESTFILES=$(circleci tests glob "packages/**/*.test.[tj]{s,sx}" | circleci tests split --split-by=timings)
260-
JEST_JUNIT_OUTPUT_NAME="junit-19.xml" yarn test ${TESTFILES}
293+
JEST_JUNIT_OUTPUT_NAME="junit-18.xml" yarn test ${TESTFILES}
261294
262295
- run:
263-
command: cp junit-19.xml ~/junit/
296+
command: cp junit-18.xml ~/junit/
297+
when: always
298+
- store_test_results:
299+
path: ~/junit
300+
- store_artifacts:
301+
path: ~/junit
302+
303+
test-canary:
304+
parallelism: 3
305+
executor: rsp-xlarge
306+
steps:
307+
- restore_cache:
308+
key: react-spectrum-canary-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
309+
310+
- run: mkdir ~/junit
311+
312+
- run:
313+
name: test
314+
command: |
315+
shopt -s globstar
316+
TESTFILES=$(circleci tests glob "packages/**/*.test.[tj]{s,sx}" | circleci tests split --split-by=timings)
317+
JEST_JUNIT_OUTPUT_NAME="junit-canary.xml" yarn test ${TESTFILES}
318+
319+
- run:
320+
command: cp junit-canary.xml ~/junit/
264321
when: always
265322
- store_test_results:
266323
path: ~/junit
@@ -368,51 +425,6 @@ jobs:
368425
paths:
369426
- '*/storybook/'
370427

371-
storybook-16:
372-
executor: rsp-large
373-
steps:
374-
- restore_cache:
375-
key: react-spectrum16-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
376-
377-
- run:
378-
name: build storybook-16
379-
command: make storybook-16
380-
381-
- persist_to_workspace:
382-
root: dist
383-
paths:
384-
- '*/storybook-16/'
385-
386-
storybook-17:
387-
executor: rsp-large
388-
steps:
389-
- restore_cache:
390-
key: react-spectrum17-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
391-
392-
- run:
393-
name: build storybook-17
394-
command: make storybook-17
395-
396-
- persist_to_workspace:
397-
root: dist
398-
paths:
399-
- '*/storybook-17/'
400-
401-
storybook-19:
402-
executor: rsp-large
403-
steps:
404-
- restore_cache:
405-
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
406-
407-
- run:
408-
name: build storybook-19
409-
command: make storybook-19
410-
411-
- persist_to_workspace:
412-
root: dist
413-
paths:
414-
- '*/storybook-19/'
415-
416428
storybook-s2:
417429
executor: rsp-large
418430
steps:
@@ -788,7 +800,8 @@ workflows:
788800
- install
789801
- install-16
790802
- install-17
791-
- install-19
803+
- install-18
804+
- install-canary
792805
- test-ssr:
793806
requires:
794807
- install
@@ -807,12 +820,18 @@ workflows:
807820
- test-17:
808821
requires:
809822
- install-17
810-
- test-19:
823+
- test-18:
824+
requires:
825+
- install-18
826+
- test-ssr-18:
827+
requires:
828+
- install-18
829+
- test-canary:
811830
requires:
812-
- install-19
813-
- test-ssr-19:
831+
- install-canary
832+
- test-ssr-canary:
814833
requires:
815-
- install-19
834+
- install-canary
816835
- test-esm:
817836
requires:
818837
- install
@@ -844,15 +863,6 @@ workflows:
844863
- storybook:
845864
requires:
846865
- install
847-
- storybook-16:
848-
requires:
849-
- install-16
850-
- storybook-17:
851-
requires:
852-
- install-17
853-
- storybook-19:
854-
requires:
855-
- install-19
856866
- storybook-s2:
857867
requires:
858868
- install
@@ -907,11 +917,10 @@ workflows:
907917
- test-16
908918
- test-ssr-17
909919
- test-17
920+
- test-ssr-18
921+
- test-18
910922
- test-esm
911923
- storybook
912-
- storybook-16
913-
- storybook-17
914-
- storybook-19
915924
- storybook-s2
916925
- docs
917926
- deploy-verdaccio:

Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@ icons: packages/@spectrum-icons/workflow/src packages/@spectrum-icons/color/src
8181
storybook:
8282
NODE_ENV=production yarn build:storybook
8383

84-
storybook-16:
85-
yarn build:storybook-16
86-
87-
storybook-17:
88-
yarn build:storybook-17
89-
90-
storybook-19:
91-
yarn build:storybook-19
92-
9384
# for now doesn't have deploy since v3 doesn't have a place for docs and stuff yet
9485
ci:
9586
$(MAKE) publish

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
"check-types": "tsc",
1313
"install-16": "node scripts/react-16-install-prep.mjs && yarn add react@^16.8.0 react-dom@^16.8.0 @testing-library/react@^12 @testing-library/react-hooks@^8 @testing-library/dom@^8 react-test-renderer@^16.9.0 && node scripts/oldReactSupport.mjs",
1414
"install-17": "node scripts/react-17-install-prep.mjs && yarn add react@^17 react-dom@^17 @testing-library/react@^12 @testing-library/react-hooks@^8 @testing-library/dom@^8 react-test-renderer@^16.9.0 && node scripts/oldReactSupport.mjs",
15-
"install-19": "node scripts/react-19-install-prep.mjs && yarn add react@next react-dom@next",
15+
"install-18": "node scripts/react-18-install-prep.mjs && yarn add react@^18 react-dom@^18",
16+
"install-canary": "node scripts/react-canary-install-prep.mjs && yarn add react@canary react-dom@canary",
1617
"start": "cross-env NODE_ENV=storybook storybook dev -p 9003 --ci -c '.storybook'",
1718
"build:storybook": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook",
18-
"build:storybook-16": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook-16",
19-
"build:storybook-17": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook-17",
20-
"build:storybook-19": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook-19",
2119
"start:chromatic": "CHROMATIC=1 NODE_ENV=storybook storybook dev -p 9004 --ci -c '.chromatic'",
2220
"build:chromatic": "CHROMATIC=1 storybook build -c .chromatic -o dist/$(git rev-parse HEAD)/chromatic",
2321
"start:chromatic-fc": "CHROMATIC=1 NODE_ENV=storybook storybook dev -p 9005 --ci -c '.chromatic-fc'",
@@ -189,9 +187,9 @@
189187
"postcss-import": "^15.1.0",
190188
"prop-types": "^15.6.0",
191189
"raf": "^3.4.0",
192-
"react": "^18.2.0",
190+
"react": "^19.1.0",
193191
"react-axe": "^3.0.2",
194-
"react-dom": "^18.2.0",
192+
"react-dom": "^19.1.0",
195193
"react-frame-component": "^5.0.0",
196194
"react-test-renderer": "^18.3.1",
197195
"recast": "^0.23",

scripts/react-18-install-prep.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
import fs from 'node:fs';
3+
4+
try {
5+
let content = fs.readFileSync('./package.json', 'utf8');
6+
let pkg = JSON.parse(content);
7+
pkg.resolutions['react'] = '^18';
8+
pkg.resolutions['react-dom'] = '^18';
9+
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
10+
} catch (e) {
11+
console.error('Error:', e);
12+
}

scripts/react-19-install-prep.mjs renamed to scripts/react-canary-install-prep.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import fs from 'node:fs';
22
import spawn from 'cross-spawn';
33

4-
// setting the version to 'next' won't work due to a yarn 1 bug
5-
let results = JSON.parse(await run('npm', ['view', 'react@next', '--json']));
6-
let version = results['dist-tags']['next'];
4+
// setting the version to 'canary' won't work due to a yarn 1 bug
5+
let results = JSON.parse(await run('npm', ['view', 'react@canary', '--json']));
6+
let version = results['dist-tags']['canary'];
77
let data = fs.readFileSync('./packages/dev/docs/package.json');
88
let pkg = JSON.parse(data);
99
pkg.dependencies['react'] = version;

yarn.lock

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27583,15 +27583,14 @@ __metadata:
2758327583
languageName: node
2758427584
linkType: hard
2758527585

27586-
"react-dom@npm:^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0, react-dom@npm:^18.2.0":
27587-
version: 18.3.1
27588-
resolution: "react-dom@npm:18.3.1"
27586+
"react-dom@npm:^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0, react-dom@npm:^19.1.0":
27587+
version: 19.1.0
27588+
resolution: "react-dom@npm:19.1.0"
2758927589
dependencies:
27590-
loose-envify: "npm:^1.1.0"
27591-
scheduler: "npm:^0.23.2"
27590+
scheduler: "npm:^0.26.0"
2759227591
peerDependencies:
27593-
react: ^18.3.1
27594-
checksum: 10c0/a752496c1941f958f2e8ac56239172296fcddce1365ce45222d04a1947e0cc5547df3e8447f855a81d6d39f008d7c32eab43db3712077f09e3f67c4874973e85
27592+
react: ^19.1.0
27593+
checksum: 10c0/3e26e89bb6c67c9a6aa86cb888c7a7f8258f2e347a6d2a15299c17eb16e04c19194e3452bc3255bd34000a61e45e2cb51e46292392340432f133e5a5d2dfb5fc
2759527594
languageName: node
2759627595
linkType: hard
2759727596

@@ -27841,9 +27840,9 @@ __metadata:
2784127840
postcss-import: "npm:^15.1.0"
2784227841
prop-types: "npm:^15.6.0"
2784327842
raf: "npm:^3.4.0"
27844-
react: "npm:^18.2.0"
27843+
react: "npm:^19.1.0"
2784527844
react-axe: "npm:^3.0.2"
27846-
react-dom: "npm:^18.2.0"
27845+
react-dom: "npm:^19.1.0"
2784727846
react-frame-component: "npm:^5.0.0"
2784827847
react-test-renderer: "npm:^18.3.1"
2784927848
recast: "npm:^0.23"
@@ -27951,12 +27950,10 @@ __metadata:
2795127950
languageName: node
2795227951
linkType: hard
2795327952

27954-
"react@npm:^18.2.0":
27955-
version: 18.3.1
27956-
resolution: "react@npm:18.3.1"
27957-
dependencies:
27958-
loose-envify: "npm:^1.1.0"
27959-
checksum: 10c0/283e8c5efcf37802c9d1ce767f302dd569dd97a70d9bb8c7be79a789b9902451e0d16334b05d73299b20f048cbc3c7d288bbbde10b701fa194e2089c237dbea3
27953+
"react@npm:^19.1.0":
27954+
version: 19.1.0
27955+
resolution: "react@npm:19.1.0"
27956+
checksum: 10c0/530fb9a62237d54137a13d2cfb67a7db6a2156faed43eecc423f4713d9b20c6f2728b026b45e28fcd72e8eadb9e9ed4b089e99f5e295d2f0ad3134251bdd3698
2796027957
languageName: node
2796127958
linkType: hard
2796227959

@@ -29014,6 +29011,13 @@ __metadata:
2901429011
languageName: node
2901529012
linkType: hard
2901629013

29014+
"scheduler@npm:^0.26.0":
29015+
version: 0.26.0
29016+
resolution: "scheduler@npm:0.26.0"
29017+
checksum: 10c0/5b8d5bfddaae3513410eda54f2268e98a376a429931921a81b5c3a2873aab7ca4d775a8caac5498f8cbc7d0daeab947cf923dbd8e215d61671f9f4e392d34356
29018+
languageName: node
29019+
linkType: hard
29020+
2901729021
"semver-diff@npm:^2.0.0":
2901829022
version: 2.1.0
2901929023
resolution: "semver-diff@npm:2.1.0"

0 commit comments

Comments
 (0)