Skip to content

Commit f016946

Browse files
feat: typegen
1 parent 55645fc commit f016946

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

app/entry.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { HydratedRouter } from 'react-router/dom';
21
import { startTransition } from 'react'
32
import { hydrateRoot } from 'react-dom/client'
3+
import { HydratedRouter } from 'react-router/dom'
44

55
if (ENV.MODE === 'production' && ENV.SENTRY_DSN) {
66
void import('./utils/monitoring.client.tsx').then(({ init }) => init())

app/entry.server.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import { PassThrough } from 'node:stream'
2-
import { createReadableStreamFromReadable } from '@react-router/node';
2+
import { createReadableStreamFromReadable } from '@react-router/node'
33

4-
import {
5-
type LoaderFunctionArgs,
6-
type ActionFunctionArgs,
7-
type HandleDocumentRequestFunction,
8-
} from 'react-router';
9-
10-
import { ServerRouter } from 'react-router';
114
import * as Sentry from '@sentry/remix'
125
import chalk from 'chalk'
136
import { isbot } from 'isbot'
147
import { renderToPipeableStream } from 'react-dom/server'
8+
import {
9+
ServerRouter,
10+
type LoaderFunctionArgs,
11+
type ActionFunctionArgs,
12+
type HandleDocumentRequestFunction,
13+
} from 'react-router'
1514
import { getEnv, init } from './utils/env.server.ts'
1615
import { getInstanceInfo } from './utils/litefs.server.ts'
1716
import { NonceProvider } from './utils/nonce-provider.ts'
@@ -55,7 +54,11 @@ export default async function handleRequest(...args: DocRequestArgs) {
5554

5655
const { pipe, abort } = renderToPipeableStream(
5756
<NonceProvider value={nonce}>
58-
<ServerRouter nonce={nonce} context={reactRouterContext} url={request.url} />
57+
<ServerRouter
58+
nonce={nonce}
59+
context={reactRouterContext}
60+
url={request.url}
61+
/>
5962
</NonceProvider>,
6063
{
6164
[callbackName]: () => {
@@ -81,7 +84,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
8184
)
8285

8386
setTimeout(abort, streamTimeout + 5000)
84-
});
87+
})
8588
}
8689

8790
export async function handleDataRequest(response: Response) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"pretest:e2e:run": "npm run build",
3434
"test:e2e:run": "cross-env CI=true playwright test",
3535
"test:e2e:install": "npx playwright install --with-deps chromium",
36-
"typecheck": "tsc",
36+
"typecheck": "react-router typegen && tsc",
3737
"validate": "run-p \"test -- --run\" lint typecheck test:e2e:run"
3838
},
3939
"eslintIgnore": [

remix.init/gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ node_modules
2424

2525
# generated files
2626
/app/components/ui/icons
27+
.react-router/

tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"include": ["**/*.ts", "**/*.tsx"],
2+
"include": ["**/*.ts", "**/*.tsx", ".react-router/types/**/*"],
33
"extends": ["@epic-web/config/typescript"],
44
"compilerOptions": {
5+
// TODO: Probably should move this into epic-web/config
6+
"types": ["@react-router/node", "vite/client"],
7+
"rootDirs": [".", "./.react-router/types"],
58
"paths": {
69
"#app/*": ["./app/*"],
710
"#tests/*": ["./tests/*"],

0 commit comments

Comments
 (0)