Skip to content

Commit

Permalink
pkg: Switch to React 19 rc1 (#2584)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker authored Nov 30, 2024
1 parent 3d9ab69 commit 5644b35
Show file tree
Hide file tree
Showing 23 changed files with 211 additions and 201 deletions.
10 changes: 4 additions & 6 deletions examples/concurrent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@
"@types/babel__core": "7.20.5",
"@types/eslint": "9.6.1",
"@types/jest": "29.5.12",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/react-test-renderer": "18.3.0",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0",
"eslint": "9.16.0",
"jest": "29.7.0",
"prettier": "3.4.1",
"react-refresh": "0.14.2",
"react-test-renderer": "18.3.1",
"typescript": "5.7.2",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
Expand All @@ -62,8 +60,8 @@
"classnames": "2.5.1",
"core-js": "3.39.0",
"history": "5.3.0",
"react": "18.3.1",
"react-dom": "18.3.1"
"react": "19.0.0-rc.1",
"react-dom": "19.0.0-rc.1"
},
"browserslist": [
"extends @anansi/browserslist-config"
Expand Down
8 changes: 4 additions & 4 deletions examples/linaria/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@types/babel__core": "^7.20.0",
"@types/eslint": "^9.0.0",
"@types/node": "^22.0.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0",
"@types/react-router-dom": "5.3.3",
"babel-loader": "9.2.1",
"eslint": "^9.0.0",
Expand All @@ -45,8 +45,8 @@
"@linaria/react": "6.2.1",
"classnames": "2.5.1",
"core-js": "3.39.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "19.0.0-rc.1",
"react-dom": "19.0.0-rc.1"
},
"browserslist": [
"extends @anansi/browserslist-config"
Expand Down
12 changes: 6 additions & 6 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"@storybook/channels": "8.4.6",
"@storybook/preview-api": "8.4.6",
"@storybook/react": "8.4.6",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.0.1",
"@types/babel__core": "^7.20.0",
"@types/eslint": "^9.0.0",
"@types/jest": "29.5.12",
Expand All @@ -40,13 +42,11 @@
"@types/prop-types": "^15.7.5",
"@types/react-router": "5.1.20",
"@types/react-router-dom": "5.3.3",
"@types/react-test-renderer": "18.3.0",
"eslint": "^9.0.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"prettier": "^3.0.0",
"react-refresh": "0.14.2",
"react-test-renderer": "18.3.1",
"sass-embedded": "^1.77.8",
"serve": "14.2.4",
"storybook": "8.4.6",
Expand All @@ -64,16 +64,16 @@
"@data-client/react": "0.14.17",
"@data-client/rest": "0.14.17",
"@types/node": "22.9.3",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0",
"antd": "5.22.2",
"classnames": "2.5.1",
"core-js": "3.39.0",
"history": "^5.3.0",
"lodash": "4.17.21",
"parse-link-header": "2.0.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "19.0.0-rc.1",
"react-dom": "19.0.0-rc.1",
"react-router-dom": "5.3.4"
},
"browserslist": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,79 +1,61 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<div
className="main"
>
<h3>
Hello
<img
src="SvgrURL"
style={
{
"width": "1em",
}
}
/>
<div
style={
{
"width": "1em",
}
}
>
[Mocked SVG]
</div>
World
<a
href="https://true.io"
>
True IO
</a>
<span
style={
{
"display": "inline-block",
"height": "10px",
"width": "10px",
}
}
>
<div>
<DocumentFragment>
<div
class="main"
>
<h3>
Hello
<img
src="SvgrURL"
style="width: 1em;"
/>
<div
style="width: 1em;"
>
[Mocked SVG]
</div>
</span>
</h3>
<p
className="mountainTop"
>
Ok again
<img
src="FileURL"
/>
/hi/bob/test.txt
/repos/:owner/:repo/issues/:number
/2/
</p>
<p
className="silly"
>
$text-color:
textColor
</p>
<p>
<img
src="SvgrURL"
/>
</p>
<code>
&lt;html&gt;
World
<a
href="https://true.io"
>
True IO
</a>
<span
style="width: 10px; height: 10px; display: inline-block;"
>
<div>
[Mocked SVG]
</div>
</span>
</h3>
<p
class="mountainTop"
>
Ok again
<img
src="FileURL"
/>
/hi/bob/test.txt /repos/:owner/:repo/issues/:number /2/
</p>
<p
class="silly"
>
$text-color: textColor
</p>
<p>
<img
src="SvgrURL"
/>
</p>
<code>
&lt;html&gt;
&lt;body&gt;&lt;h1&gt;My HTML Works&lt;/h1&gt;&lt;/body&gt;
&lt;/html&gt;
</code>
</div>
</code>
</div>
</DocumentFragment>
`;
7 changes: 4 additions & 3 deletions examples/typescript/src/pages/Home/__tests__/home.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { render, screen } from '@testing-library/react';
import React from 'react';
import renderer from 'react-test-renderer';

import Home from '../index';

it('renders correctly', () => {
const tree = renderer.create(<Home />).toJSON();
expect(tree).toMatchSnapshot();
const { asFragment } = render(<Home />);

expect(asFragment()).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders 1`] = `null`;
exports[`renders 1`] = `<DocumentFragment />`;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DataProvider } from '@data-client/react';
import { FixtureEndpoint, mockInitialState } from '@data-client/test';
import { render } from '@testing-library/react';
import React, { Suspense } from 'react';
import { MemoryRouter } from 'react-router-dom';
import renderer from 'react-test-renderer';

import { PostResource, UserResource } from '../../../data/resources';
import PostList from '../index';
Expand Down Expand Up @@ -58,6 +58,7 @@ it('renders', () => {
</MemoryRouter>
</DataProvider>
);
const tree = renderer.create(element).toJSON();
expect(tree).toMatchSnapshot();
const { asFragment } = render(element);

expect(asFragment()).toMatchSnapshot();
});
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@
"webpack-dev-server": "5.1.0"
},
"resolutions": {
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0",
"normalize-url": "^6"
},
"dependencies": {
"@lerna-lite/publish": "^3.0.0",
"@lerna-lite/version": "^3.0.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"react": "18.3.1",
"react-dom": "18.3.1"
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0",
"react": "19.0.0-rc.1",
"react-dom": "19.0.0-rc.1"
},
"packageManager": "yarn@4.5.3"
}
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@
"@types/compression": "1.7.5",
"@types/express": "^4.17.17",
"@types/node": "^22.0.0",
"@types/react": "^18.0.29",
"@types/react-dom": "^18.0.11",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0",
"@types/source-map-support": "0.5.10",
"@types/tmp": "0.2.6",
"@types/webpack-hot-middleware": "2.25.9",
"@types/webpack-node-externals": "^3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "19.0.0-rc.1",
"react-dom": "19.0.0-rc.1"
},
"dependencies": {
"@anansi/router": "workspace:^",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/floodSpouts.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from 'react';
import { hydrateRoot } from 'react-dom/client';

export default async function floodSpouts(
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/laySpouts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import crypto from 'crypto';
import type { JSX } from 'react';
import { renderToPipeableStream as reactRender } from 'react-dom/server';

import type { Render } from './scripts/types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/spouts/antd.server.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { type JSX } from 'react';

import type { ServerSpout } from './types.js';

Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/spouts/app.server.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from 'react';

import { ServerProps } from './types.js';

const appSpout =
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/spouts/app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from 'react';
const appSpout =
(app: JSX.Element) =>
<P extends Record<string, unknown>>(props: P) =>
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/spouts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Route, RouteController } from '@anansi/router';
import { Request, Response } from 'express';
import { History } from 'history';
import { IncomingMessage, ServerResponse } from 'http';
import type { JSX } from 'react';
import type { StatsCompilation } from 'webpack';

/* Variables from the rendering call */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import renderer from 'react-test-renderer';
import { render } from '@testing-library/react'
import { DataProvider, AsyncBoundary } from '@data-client/react';
import { mockInitialState } from '@data-client/test';

import { TickerFixtures } from '@/resources/Ticker';
import Home from '@/pages/Home';

it('renders correctly', () => {
const tree = renderer
.create(
<DataProvider initialState={mockInitialState([TickerFixtures.get])}>
<AsyncBoundary>
<Home />
</AsyncBoundary>
</DataProvider>,
)
.toJSON();
expect(tree).toMatchSnapshot();
const { asFragment } = render(
<DataProvider initialState={mockInitialState([TickerFixtures.get])}>
<AsyncBoundary>
<Home />
</AsyncBoundary>
</DataProvider>
);
expect(asFragment()).toMatchSnapshot();
});
2 changes: 0 additions & 2 deletions packages/generator-js/src/spa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ export default class extends BetterGenerator {
'@types/react',
'@types/react-dom',
'@data-client/test',
'@types/react-test-renderer',
'react-test-renderer',
'react-refresh',
]),
await this.addDependencies([
Expand Down
4 changes: 2 additions & 2 deletions packages/generator-js/src/testing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default class TestingGenerator extends BetterGenerator {
'@anansi/jest-preset',
'jest',
'@types/jest',
'@types/react-test-renderer',
'react-test-renderer',
'@testing-library/react',
'@testing-library/dom',
'jest-environment-jsdom',
]),
]);
Expand Down
Loading

0 comments on commit 5644b35

Please sign in to comment.