Skip to content

Commit 0a13aeb

Browse files
committed
Migration from remix to rr7
1 parent cbad207 commit 0a13aeb

File tree

34 files changed

+7823
-11801
lines changed

34 files changed

+7823
-11801
lines changed

package-lock.json

Lines changed: 7528 additions & 11644 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"test:cov": "vitest run --coverage",
2626
"postbuild": "npm run check:exports",
2727
"build": "tsup src/index.ts --config tsup.config.ts",
28-
"remix:dev": "npm run dev -w test-apps/remix-vite",
29-
"remix:cjs:dev": "npm run dev -w test-apps/remix-vite-cjs",
28+
"remix:dev": "npm run dev -w test-apps/react-router-vite",
29+
"remix:cjs:dev": "npm run dev -w test-apps/react-router-cjs",
3030
"build:dev": "tsup src/index.ts --config tsup.dev.config.ts",
3131
"build:dev:watch": "npm run build:dev -- --watch",
3232
"build:dev:cjs:watch": "npm run build:dev -- --watch",
@@ -36,7 +36,7 @@
3636
"check": "biome check .",
3737
"check:fix": "biome check --fix .",
3838
"typecheck": "tsc",
39-
"validate": "npm run check && npm run tsc && npm run test",
39+
"validate": "npm run check && npm run typecheck && npm run test",
4040
"check:exports": "attw --pack .",
4141
"local-release": "changeset version && changeset publish"
4242
},
@@ -49,8 +49,13 @@
4949
"bugs": {
5050
"url": "https://github.com/forge42dev/open-source-stack/issues"
5151
},
52-
"files": ["dist"],
53-
"workspaces": [".", "test-apps/*"],
52+
"files": [
53+
"dist"
54+
],
55+
"workspaces": [
56+
".",
57+
"test-apps/*"
58+
],
5459
"homepage": "https://github.com/forge42dev/open-source-stack#readme",
5560
"devDependencies": {
5661
"@arethetypeswrong/cli": "^0.15.4",
@@ -78,4 +83,4 @@
7883
"engines": {
7984
"node": ">=20.0.0"
8085
}
81-
}
86+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// React Router generated types for route:
2+
// root.tsx
3+
4+
import type * as T from "react-router/route-module"
5+
6+
7+
8+
type Module = typeof import("../root.js")
9+
10+
export type Info = {
11+
parents: [],
12+
id: "root"
13+
file: "root.tsx"
14+
path: ""
15+
params: {} & { [key: string]: string | undefined }
16+
module: Module
17+
loaderData: T.CreateLoaderData<Module>
18+
actionData: T.CreateActionData<Module>
19+
}
20+
21+
export namespace Route {
22+
export type LinkDescriptors = T.LinkDescriptors
23+
export type LinksFunction = () => LinkDescriptors
24+
25+
export type MetaArgs = T.CreateMetaArgs<Info>
26+
export type MetaDescriptors = T.MetaDescriptors
27+
export type MetaFunction = (args: MetaArgs) => MetaDescriptors
28+
29+
export type HeadersArgs = T.HeadersArgs
30+
export type HeadersFunction = (args: HeadersArgs) => Headers | HeadersInit
31+
32+
export type LoaderArgs = T.CreateServerLoaderArgs<Info>
33+
export type ClientLoaderArgs = T.CreateClientLoaderArgs<Info>
34+
export type ActionArgs = T.CreateServerActionArgs<Info>
35+
export type ClientActionArgs = T.CreateClientActionArgs<Info>
36+
37+
export type HydrateFallbackProps = T.CreateHydrateFallbackProps<Info>
38+
export type ComponentProps = T.CreateComponentProps<Info>
39+
export type ErrorBoundaryProps = T.CreateErrorBoundaryProps<Info>
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// React Router generated types for route:
2+
// ./routes/_index.tsx
3+
4+
import type * as T from "react-router/route-module"
5+
6+
import type { Info as Parent0 } from "../../+types/root.js"
7+
8+
type Module = typeof import("../_index.js")
9+
10+
export type Info = {
11+
parents: [Parent0],
12+
id: "routes/_index"
13+
file: "./routes/_index.tsx"
14+
path: "/"
15+
params: {} & { [key: string]: string | undefined }
16+
module: Module
17+
loaderData: T.CreateLoaderData<Module>
18+
actionData: T.CreateActionData<Module>
19+
}
20+
21+
export namespace Route {
22+
export type LinkDescriptors = T.LinkDescriptors
23+
export type LinksFunction = () => LinkDescriptors
24+
25+
export type MetaArgs = T.CreateMetaArgs<Info>
26+
export type MetaDescriptors = T.MetaDescriptors
27+
export type MetaFunction = (args: MetaArgs) => MetaDescriptors
28+
29+
export type HeadersArgs = T.HeadersArgs
30+
export type HeadersFunction = (args: HeadersArgs) => Headers | HeadersInit
31+
32+
export type LoaderArgs = T.CreateServerLoaderArgs<Info>
33+
export type ClientLoaderArgs = T.CreateClientLoaderArgs<Info>
34+
export type ActionArgs = T.CreateServerActionArgs<Info>
35+
export type ClientActionArgs = T.CreateClientActionArgs<Info>
36+
37+
export type HydrateFallbackProps = T.CreateHydrateFallbackProps<Info>
38+
export type ComponentProps = T.CreateComponentProps<Info>
39+
export type ErrorBoundaryProps = T.CreateErrorBoundaryProps<Info>
40+
}
File renamed without changes.

test-apps/remix-vite-cjs/app/entry.client.tsx renamed to test-apps/react-router-cjs/app/entry.client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
* For more information, see https://remix.run/file-conventions/entry.client
55
*/
66

7-
import { RemixBrowser } from "@remix-run/react";
7+
import { HydratedRouter } from "react-router/dom"
88
import { startTransition, StrictMode } from "react";
99
import { hydrateRoot } from "react-dom/client";
1010

1111
startTransition(() => {
1212
hydrateRoot(
1313
document,
1414
<StrictMode>
15-
<RemixBrowser />
15+
<HydratedRouter />
1616
</StrictMode>
1717
);
1818
});

test-apps/remix-vite/app/entry.server.tsx renamed to test-apps/react-router-cjs/app/entry.server.tsx

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
*/
66

77
import { PassThrough } from "node:stream";
8-
9-
import type { AppLoadContext, EntryContext } from "@remix-run/node";
10-
import { createReadableStreamFromReadable } from "@remix-run/node";
11-
import { RemixServer } from "@remix-run/react";
8+
import { createReadableStreamFromReadable } from "@react-router/node";
9+
import { type AppLoadContext, type EntryContext, ServerRouter } from "react-router"
1210
import { isbot } from "isbot";
1311
import { renderToPipeableStream } from "react-dom/server";
1412

@@ -18,7 +16,7 @@ export default function handleRequest(
1816
request: Request,
1917
responseStatusCode: number,
2018
responseHeaders: Headers,
21-
remixContext: EntryContext,
19+
reactRouterContext: EntryContext,
2220
// This is ignored so we can keep it in the template for visibility. Feel
2321
// free to delete this parameter in your app if you're not using it!
2422
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -29,30 +27,26 @@ export default function handleRequest(
2927
request,
3028
responseStatusCode,
3129
responseHeaders,
32-
remixContext
30+
reactRouterContext
3331
)
3432
: handleBrowserRequest(
3533
request,
3634
responseStatusCode,
3735
responseHeaders,
38-
remixContext
36+
reactRouterContext
3937
);
4038
}
4139

4240
function handleBotRequest(
4341
request: Request,
4442
responseStatusCode: number,
4543
responseHeaders: Headers,
46-
remixContext: EntryContext
44+
reactRouterContext: EntryContext
4745
) {
4846
return new Promise((resolve, reject) => {
4947
let shellRendered = false;
5048
const { pipe, abort } = renderToPipeableStream(
51-
<RemixServer
52-
context={remixContext}
53-
url={request.url}
54-
abortDelay={ABORT_DELAY}
55-
/>,
49+
<ServerRouter context={reactRouterContext} url={request.url} />,
5650
{
5751
onAllReady() {
5852
shellRendered = true;
@@ -93,16 +87,12 @@ function handleBrowserRequest(
9387
request: Request,
9488
responseStatusCode: number,
9589
responseHeaders: Headers,
96-
remixContext: EntryContext
90+
reactRouterContext: EntryContext
9791
) {
9892
return new Promise((resolve, reject) => {
9993
let shellRendered = false;
10094
const { pipe, abort } = renderToPipeableStream(
101-
<RemixServer
102-
context={remixContext}
103-
url={request.url}
104-
abortDelay={ABORT_DELAY}
105-
/>,
95+
<ServerRouter context={reactRouterContext} url={request.url} />,
10696
{
10797
onShellReady() {
10898
shellRendered = true;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Outlet,
55
Scripts,
66
ScrollRestoration,
7-
} from "@remix-run/react";
7+
} from "react-router";
88

99
export function Layout({ children }: { children: React.ReactNode }) {
1010
return (

0 commit comments

Comments
 (0)