Skip to content

Commit 0f29a37

Browse files
authored
feat: Add React 19 support to Docusaurus v3 (#10763)
1 parent f196a1e commit 0f29a37

File tree

37 files changed

+111
-85
lines changed

37 files changed

+111
-85
lines changed

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"yarn.lock",
2727
"project-words.txt",
2828
"__snapshots__",
29+
"admin/scripts",
2930
"website/src/data/users.tsx",
3031
"website/src/data/tweets.tsx",
3132
"website/docusaurus.config.localized.json",

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Check for suspicious yarn.lock
3535
# for allowed aliases, see https://github.com/yargs/cliui/pull/139/files#r1670711112
36-
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases react-loadable string-width-cjs strip-ansi-cjs wrap-ansi-cjs
36+
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases react-loadable react-helmet-async string-width-cjs strip-ansi-cjs wrap-ansi-cjs
3737

3838
- name: Lint
3939
run: |

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
env:
5050
# Our website should build even with limited memory
5151
# See https://github.com/facebook/docusaurus/pull/10590
52-
NODE_OPTIONS: '--max-old-space-size=400'
52+
NODE_OPTIONS: '--max-old-space-size=450'
5353
DOCUSAURUS_PERF_LOGGER: 'true'
5454
- name: Docusaurus site CSS order
5555
run: yarn workspace website test:css-order

admin/scripts/test-release.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# This source code is licensed under the MIT license found in the
66
# LICENSE file in the root directory of this source tree.
77

8-
set -euo pipefail
8+
set -xeuo pipefail
9+
10+
rm -rf ../test-website
911

1012
CUSTOM_REGISTRY_URL="http://localhost:4873"
1113
NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version")-NEW"
@@ -52,7 +54,8 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
5254
cd ..
5355

5456
# Build skeleton website with new version
55-
npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS
57+
npm_config_registry="$CUSTOM_REGISTRY_URL" npx --yes --loglevel silly create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS
58+
5659

5760
# Stop Docker container
5861
if [[ -z "${KEEP_CONTAINER:-true}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then

admin/test-bad-package/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {version as ReactVersion} from 'react';
1212
import {version as ReactDOMVersion} from 'react-dom';
1313

1414
export function TestComponent() {
15-
const expectedVersion = 18;
15+
const expectedVersion = 19;
1616
if (!ReactVersion.startsWith(`${expectedVersion}`)) {
1717
throw new Error(
1818
`'test-bad-package/README.mdx' is rendered with bad React version: ${ReactVersion}`,

argos/tests/screenshot.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,14 @@ function throwOnConsole(page: Page) {
135135
// it's already happening in main branch
136136
'Failed to load resource: the server responded with a status of 404 (Not Found)',
137137

138-
// TODO looks like legit hydration bugs to fix
139-
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=light"',
140-
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=dark"',
138+
// TODO legit hydration bugs to fix on embeds of /docs/styling-layout
139+
// useLocation() returns window.search/hash immediately :s
140+
'/docs/configuration?docusaurus-theme=light',
141+
'/docs/configuration?docusaurus-theme=dark',
142+
143+
// Warning because react-live not supporting React automatic JSX runtime
144+
// See https://github.com/FormidableLabs/react-live/issues/405
145+
'Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance',
141146

142147
// TODO weird problem related to KaTeX fonts refusing to decode?
143148
// on /docs/markdown-features/math-equations

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"prettier": "^2.8.8",
116116
"react": "^18.0.0",
117117
"react-dom": "^18.0.0",
118-
"react-helmet-async": "^1.3.0",
119118
"react-test-renderer": "^18.0.0",
120119
"rimraf": "^3.0.2",
121120
"sharp": "^0.32.3",

packages/create-docusaurus/templates/classic-typescript/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"@mdx-js/react": "^3.0.0",
2121
"clsx": "^2.0.0",
2222
"prism-react-renderer": "^2.3.0",
23-
"react": "^18.0.0",
24-
"react-dom": "^18.0.0"
23+
"react": "^19.0.0",
24+
"react-dom": "^19.0.0"
2525
},
2626
"devDependencies": {
2727
"@docusaurus/module-type-aliases": "3.6.3",

packages/create-docusaurus/templates/classic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"@mdx-js/react": "^3.0.0",
2020
"clsx": "^2.0.0",
2121
"prism-react-renderer": "^2.3.0",
22-
"react": "^18.0.0",
23-
"react-dom": "^18.0.0"
22+
"react": "^19.0.0",
23+
"react-dom": "^19.0.0"
2424
},
2525
"devDependencies": {
2626
"@docusaurus/module-type-aliases": "3.6.3",

packages/docusaurus-mdx-loader/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
"unist-util-remove-position": "^5.0.0"
5959
},
6060
"peerDependencies": {
61-
"react": "^18.0.0",
62-
"react-dom": "^18.0.0"
61+
"react": "^18.0.0 || ^19.0.0",
62+
"react-dom": "^18.0.0 || ^19.0.0"
6363
},
6464
"engines": {
6565
"node": ">=18.0"

0 commit comments

Comments
 (0)