Skip to content

Commit

Permalink
enhance: Use React 19 rc1 (#3279)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker authored Nov 24, 2024
1 parent 99cd041 commit 156e3fe
Show file tree
Hide file tree
Showing 35 changed files with 663 additions and 1,156 deletions.
8 changes: 8 additions & 0 deletions .changeset/great-bats-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@data-client/use-enhanced-reducer': patch
'@data-client/react': patch
'@data-client/test': patch
'@data-client/ssr': patch
---

Improve compatibility with React 19
36 changes: 22 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
npm pkg set 'workspaces[]'='examples/*'
- restore_cache:
keys:
- v11-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
- v12-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
# fallback to using the latest cache if no exact match is found
- v11-dependencies-
- v12-dependencies-
- run:
name: yarn install
command: |
Expand All @@ -32,13 +32,13 @@ jobs:
paths:
- .yarn/cache
- .yarn/install-state.gz
key: v11-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
key: v12-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}
- run: yarn run ci:build:types
- run: yarn run ci:build
- persist_to_workspace:
root: ~/
paths:
# excplitily list so we can ignore some directories that are not needed
# explicitly list so we can ignore some directories that are not needed
- project/packages
- project/examples
- project/node_modules
Expand Down Expand Up @@ -85,26 +85,30 @@ jobs:
at: ~/
- run:
command: |
if [ "<< parameters.react-version >>" != "^18" ]; then
if [ "<< parameters.react-version >>" == "^17.0.0" ]; then
YARN_ENABLE_GLOBAL_CACHE=false yarn remove @react-navigation/native @react-navigation/native-stack react-native-screens
YARN_ENABLE_GLOBAL_CACHE=false yarn workspace @data-client/react remove @react-navigation/native
YARN_ENABLE_GLOBAL_CACHE=false yarn add --dev react@<< parameters.react-version >> react-dom@<< parameters.react-version >> react-test-renderer@<< parameters.react-version >> @testing-library/react@^12.0.0 @testing-library/react-hooks @react-navigation/native@^6.0.0 @react-navigation/native-stack@^6.0.0 react-native-screens@^3.0.0
YARN_ENABLE_GLOBAL_CACHE=false yarn workspace @data-client/react add @react-navigation/native@^6.0.0
YARN_ENABLE_GLOBAL_CACHE=false yarn workspace @data-client/test add @testing-library/react@^12.0.0
elif [ "<< parameters.react-version >>" == "^18" ]; then
YARN_ENABLE_GLOBAL_CACHE=false yarn add --dev react@<< parameters.react-version >> react-dom@<< parameters.react-version >> react-test-renderer@<< parameters.react-version >>
fi
- run:
command: |
if [ "<< parameters.react-version >>" == "^17.0.0" ]; then
yarn test:ci --maxWorkers=3 --selectProjects ReactDOM ReactNative --testPathPattern packages/react packages/use-enhanced-reducer packages/img
elif [ "<< parameters.react-version >>" == "^18" ]; then
curl -Os https://uploader.codecov.io/latest/linux/codecov;
chmod +x codecov;
yarn run test:coverage --ci --maxWorkers=4 --coverageReporters=text-lcov > ./lcov.info;
yarn run test:coverage --ci --maxWorkers=3 --coverageReporters=text-lcov > ./lcov.info;
if [ "$CODECOV_TOKEN" != "" ]; then
./codecov -t ${CODECOV_TOKEN} < ./lcov.info || true;
else
./codecov < ./lcov.info || true;
fi
else
yarn test:ci --maxWorkers=3 --selectProjects ReactDOM ReactNative
yarn test:ci --maxWorkers=4 --selectProjects Node ReactDOM --testPathPattern packages/react packages/use-enhanced-reducer packages/img
fi
node_matrix:
Expand Down Expand Up @@ -146,21 +150,25 @@ jobs:
- run:
command: |
if [ "<< parameters.typescript-version >>" != "latest" ]; then
YARN_ENABLE_GLOBAL_CACHE=false yarn add --dev typescript@<< parameters.typescript-version >>
YARN_ENABLE_GLOBAL_CACHE=false yarn add --dev typescript@~<< parameters.typescript-version >>
fi
if [ "<< parameters.typescript-version >>" == "~4.0" ]; then
YARN_ENABLE_GLOBAL_CACHE=false yarn workspaces foreach -Rt --from github-app --from todo-app add -DE @types/[email protected]
if [[ "<< parameters.typescript-version >>" == "4.0" || \
"<< parameters.typescript-version >>" == "4.1" || \
"<< parameters.typescript-version >>" == "4.3" ]]; then
sed -i '/"@types\/react":/d' package.json
sed -i '/"@types\/react-dom":/d' package.json
YARN_ENABLE_GLOBAL_CACHE=false yarn workspaces foreach -Rt --from github-app --from todo-app add -DE @types/react@ts<< parameters.typescript-version >>
fi
- run:
name: typecheck
command: |
if [ "<< parameters.typescript-version >>" == "latest" ] || [ "<< parameters.typescript-version >>" == "~5.3" ] || [ "<< parameters.typescript-version >>" == "~4.8" ]; then
if [ "<< parameters.typescript-version >>" == "latest" ] || [ "<< parameters.typescript-version >>" == "5.3" ] || [ "<< parameters.typescript-version >>" == "4.8" ]; then
yarn run tsc --project examples/todo-app/tsconfig.json
yarn run tsc --project examples/github-app/tsconfig.json
fi
yarn run tsc --project examples/todo-app/tsconfig.typetest.json
yarn run tsc --project examples/github-app/tsconfig.typetest.json
if [ "<< parameters.typescript-version >>" != "~4.0" ]; then
if [ "<< parameters.typescript-version >>" != "4.0" ]; then
yarn run tsc --project examples/todo-app/tsconfig.typetest41.json
fi
Expand Down Expand Up @@ -208,7 +216,7 @@ workflows:
- unit_tests:
matrix:
parameters:
react-version: ["^17.0.0", "^18"]
react-version: ["^17.0.0", "^18", "latest"]
requires:
- setup
- node_matrix:
Expand Down Expand Up @@ -237,7 +245,7 @@ workflows:
# 4.1 is min version for rest package working well
# 4.3
# 4.7 (but its broken so we do 4.8) lets you apply a generic type to a function type to see its return value
typescript-version: ["~4.0", "~4.1", "~4.3", "~4.8", "~5.3", "latest"]
typescript-version: ["4.0", "4.1", "4.3", "4.8", "5.3", "latest"]
requires:
- setup
- esmodule-loosenulltypes:
Expand Down
4 changes: 2 additions & 2 deletions examples/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"@data-client/normalizr": "workspace:^",
"benchmark": "^2.1.4",
"normalizr": "^3.6.2",
"react": "^18.2.0"
"react": "^19.0.0-rc.1"
},
"devDependencies": {
"@anansi/webpack-config": "^20.0.0",
"@babel/core": "7.26.0",
"@babel/node": "7.26.0",
"@types/babel__core": "^7",
"@types/benchmark": "2.1.5",
"@types/react": "18.3.12",
"@types/react": "npm:[email protected]",
"webpack": "^5.76.2",
"webpack-cli": "^5.1.4"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/coin-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"@data-client/rest": "^0.14.0",
"d3": "^7.9.0",
"history": "*",
"react": "^18.3.0",
"react-dom": "^18.3.0"
"react": "^19.0.0-rc.1",
"react-dom": "^19.0.0-rc.1"
},
"main": "src/index.ts",
"types": "src/index.ts",
Expand Down
Loading

0 comments on commit 156e3fe

Please sign in to comment.