Skip to content

Commit a660f12

Browse files
committed
chore(repo): update for turborepo
1 parent 143d559 commit a660f12

25 files changed

+1257
-1235
lines changed

.npmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
auto-install-peers = true
1+
package-manager-strict=false

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
"mode": "auto"
2020
}
2121
],
22+
"eslint.validate": [
23+
"javascript",
24+
"javascriptreact",
25+
"typescript",
26+
"typescriptreact",
27+
],
2228
"files.associations": {
2329
"*.css": "tailwindcss",
2430
"*.postcss": "tailwindcss",
@@ -82,6 +88,7 @@
8288
"editor.formatOnSave": true
8389
},
8490
"typescript.preferences.includePackageJsonAutoImports": "auto",
91+
"typescript.preferences.importModuleSpecifier": "non-relative",
8592
"[ignore]": {
8693
"editor.defaultFormatter": "foxundermoon.shell-format"
8794
},

apps/web/.env.example

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
SENTRY_DSN=
2-
STAGE=development
3-
SESSION_SECRET="secret"
1+
NODE_ENV=development
2+
SESSION_SECRET=your_secret_key

apps/web/.eslintignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules
2+
**/**/node_modules
3+
**/**/.next
4+
**/**/public
5+
6+
# Ignore specific files
7+
dist/
8+
coverage/
9+
10+
# turbo
11+
.turbo
12+
.vercel
13+
.public
14+
.build

apps/web/.gitignore

-19
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,6 @@ node_modules
77
.env.*
88
!.env.example
99
.DS_Store
10-
# Editor directories and files
11-
.vscode/*
12-
!.vscode/extensions.json
13-
.idea
14-
.DS_Store
15-
*.suo
16-
*.ntvs*
17-
*.njsproj
18-
*.sln
19-
*.sw?
20-
21-
# Logs
22-
logs
23-
*.log
24-
npm-debug.log*
25-
yarn-debug.log*
26-
yarn-error.log*
27-
pnpm-debug.log*
28-
lerna-debug.log*
2910

3011
# Sentry Config File
3112
.sentryclirc

apps/web/app/entry.server.tsx

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
import { RemixServer } from "@remix-run/react";
22
import {
3-
AppLoadContext,
43
handleRequest as vercelHandleRequest,
4+
type ActionFunctionArgs,
5+
type AppLoadContext,
56
type EntryContext,
7+
type LoaderFunctionArgs,
68
} from "@vercel/remix";
79
import { getEnv, init } from "./utils/env.server";
810

911
init();
1012
global.ENV = getEnv();
1113

14+
export function handleError(
15+
error: unknown,
16+
{ request }: LoaderFunctionArgs | ActionFunctionArgs,
17+
) {
18+
if (!request.signal.aborted) {
19+
// If you want to log errors to an external service like Sentry, you can
20+
// Sentry.captureRemixServerException(error, "remix.server", request);
21+
console.error(error);
22+
}
23+
}
24+
1225
export default async function handleRequest(
1326
request: Request,
1427
responseStatusCode: number,
@@ -19,7 +32,7 @@ export default async function handleRequest(
1932
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2033
loadContext: AppLoadContext,
2134
) {
22-
let remixServer = (
35+
const remixServer = (
2336
<RemixServer
2437
context={remixContext}
2538
url={request.url}

apps/web/app/root.tsx

+70-72
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,50 @@ import { TailwindIndicator } from "./components/tailwind-indicator";
2727
import { metaDetails } from "./constants";
2828
import { themeSessionResolver } from "./sessions.server";
2929
import { getEnv } from "./utils/env.server";
30-
import { useNonce } from "./utils/nonce-provider";
3130

32-
export const links: LinksFunction = () => [
33-
{
34-
rel: "apple-touch-icon",
35-
sizes: "180x180",
36-
href: "/apple-touch-icon.png",
37-
},
38-
{
39-
rel: "icon",
40-
type: "image/png",
41-
sizes: "32x32",
42-
href: "/favicon-32x32.png",
43-
},
44-
{
45-
rel: "icon",
46-
type: "image/png",
47-
sizes: "16x16",
48-
href: "/favicon-16x16.png",
49-
},
50-
{
51-
rel: "mask-icon",
52-
href: "/safari-pinned-tab.svg",
53-
color: "#fb7f44",
54-
},
55-
{
56-
rel: "manifest",
57-
href: "/site.webmanifest",
58-
crossOrigin: "use-credentials",
59-
},
60-
{ rel: "stylesheet", href: styles },
61-
];
31+
export const links: LinksFunction = () => {
32+
const preloadedFonts = [
33+
"GeistVariableVF.woff2",
34+
"JetBrainsMono[wght].woff2",
35+
"JetBrainsMono-Italic[wght].woff2",
36+
];
37+
return [
38+
{
39+
rel: "apple-touch-icon",
40+
sizes: "180x180",
41+
href: "/apple-touch-icon.png",
42+
},
43+
{
44+
rel: "icon",
45+
type: "image/png",
46+
sizes: "32x32",
47+
href: "/favicon-32x32.png",
48+
},
49+
{
50+
rel: "icon",
51+
type: "image/png",
52+
sizes: "16x16",
53+
href: "/favicon-16x16.png",
54+
},
55+
{
56+
rel: "mask-icon",
57+
href: "/safari-pinned-tab.svg",
58+
color: "#fb7f44",
59+
},
60+
{
61+
rel: "manifest",
62+
href: "/site.webmanifest",
63+
crossOrigin: "use-credentials",
64+
},
65+
{ rel: "stylesheet", href: styles },
66+
...preloadedFonts.map((font) => ({
67+
rel: "preload",
68+
as: "font",
69+
href: `/fonts/${font}`,
70+
crossOrigin: "anonymous" as const,
71+
})),
72+
];
73+
};
6274

6375
export const meta: MetaFunction = () => [
6476
{
@@ -93,24 +105,25 @@ export async function loader({ request }: LoaderFunctionArgs) {
93105
};
94106
}
95107

96-
export function Layout(props: { children: React.ReactNode }) {
108+
export default function App() {
97109
const data = useLoaderData<typeof loader>();
98110
return (
99111
<ThemeProvider
100112
specifiedTheme={data.theme}
101113
themeAction="/action/set-theme"
102114
>
103-
<LayoutInner>{props.children}</LayoutInner>
115+
<LayoutInner>
116+
<Outlet />
117+
</LayoutInner>
104118
</ThemeProvider>
105119
);
106120
}
107121

108122
export function LayoutInner(props: { children: React.ReactNode }) {
109123
const data = useLoaderData<typeof loader>();
110124
const [theme] = useTheme();
111-
const nonce = useNonce();
112125

113-
const isProduction = data.ENV.STAGE === "production";
126+
const isProduction = data.ENV.VERCEL_ENV === "production";
114127

115128
return (
116129
<html
@@ -137,59 +150,44 @@ export function LayoutInner(props: { children: React.ReactNode }) {
137150
</div>
138151
</div>
139152
<TailwindIndicator />
140-
{isProduction && <VercelAnalytics />}
141-
{isProduction && <SpeedInsights />}
142153
<Toaster />
143154
<GlobalLoader />
144155
<script
145-
nonce={nonce}
146156
// biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>
147157
dangerouslySetInnerHTML={{
148158
__html: `window.ENV = ${JSON.stringify(ENV)}`,
149159
}}
150160
/>
151-
<ScrollRestoration nonce={nonce} />
152-
<Scripts nonce={nonce} />
161+
<ScrollRestoration />
162+
<Scripts />
163+
{isProduction && <VercelAnalytics />}
164+
{isProduction && <SpeedInsights />}
153165
</body>
154166
</html>
155167
);
156168
}
157169

158-
function App() {
159-
return <Outlet />;
160-
}
161-
162-
export default App;
163-
164170
export function ErrorBoundary() {
165171
const error = useRouteError();
166172

167173
return (
168-
<Layout>
169-
<ErrorComp />
170-
</Layout>
171-
);
172-
}
173-
174-
function ErrorComp() {
175-
const error = useRouteError();
176-
let status = 500;
177-
let message = "An unexpected error occurred.";
178-
if (isRouteErrorResponse(error)) {
179-
status = error.status;
180-
switch (error.status) {
181-
case 404:
182-
message = "Page Not Found";
183-
break;
184-
}
185-
} else {
186-
console.error(error);
187-
}
188-
189-
return (
190-
<div className="container prose py-8">
191-
<h1>{status}</h1>
192-
<p>{message}</p>
193-
</div>
174+
<html lang="en">
175+
<head>
176+
<title>Oops!</title>
177+
<Meta />
178+
<Links />
179+
</head>
180+
<body>
181+
<h1>
182+
{isRouteErrorResponse(error)
183+
? `${error.status} ${error.statusText}`
184+
: error instanceof Error
185+
? error.message
186+
: "Unknown Error"}
187+
</h1>
188+
<Outlet />
189+
<Scripts />
190+
</body>
191+
</html>
194192
);
195193
}

apps/web/app/routes/_index/route.tsx

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import {
22
type ClientLoaderFunctionArgs,
3+
isRouteErrorResponse,
34
Link,
45
useLoaderData,
6+
useRouteError,
57
} from "@remix-run/react";
68
import type { MetaFunction } from "@vercel/remix";
79
import { wrap } from "comlink";
810
import { Loader2 } from "lucide-react";
9-
import { Suspense, lazy, useState } from "react";
11+
import { lazy, Suspense, useState } from "react";
1012
import {
1113
AlertDialog,
1214
AlertDialogAction,
@@ -185,3 +187,29 @@ function NotSupportedModal() {
185187
</>
186188
);
187189
}
190+
191+
export function ErrorBoundary() {
192+
const error = useRouteError();
193+
194+
if (isRouteErrorResponse(error)) {
195+
return (
196+
<div>
197+
<h1>
198+
{error.status} {error.statusText}
199+
</h1>
200+
<p>{error.data}</p>
201+
</div>
202+
);
203+
} else if (error instanceof Error) {
204+
return (
205+
<div>
206+
<h1>Error</h1>
207+
<p>{error.message}</p>
208+
<p>The stack trace is:</p>
209+
<pre>{error.stack}</pre>
210+
</div>
211+
);
212+
} else {
213+
return <h1>Unknown Error</h1>;
214+
}
215+
}

apps/web/app/routes/lite/components/editor-panel.tsx

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { DragHandleDots2Icon } from "@radix-ui/react-icons";
33
import { Loader2 } from "lucide-react";
44
import { type editor } from "monaco-editor";
55

6-
import { Suspense, useRef } from "react";
6+
import { useRef } from "react";
77
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
88
import { cn } from "~/lib/utils";
99

@@ -51,21 +51,19 @@ function CurrentEditor() {
5151
}
5252

5353
return (
54-
<Suspense>
55-
<Editor
56-
height="90vh"
57-
defaultLanguage="javascript"
58-
defaultValue="// some comment"
59-
onMount={handleEditorDidMount}
60-
loading={
61-
<div className="absolute right-4 top-2 z-10">
62-
<Loader2
63-
name="loader-circle"
64-
className="size-4 animate-spin text-primary"
65-
/>
66-
</div>
67-
}
68-
/>
69-
</Suspense>
54+
<Editor
55+
height="90vh"
56+
defaultLanguage="sql"
57+
defaultValue="// some comment"
58+
onMount={handleEditorDidMount}
59+
loading={
60+
<div className="absolute right-4 top-2 z-10">
61+
<Loader2
62+
name="loader-circle"
63+
className="size-4 animate-spin text-primary"
64+
/>
65+
</div>
66+
}
67+
/>
7068
);
7169
}

0 commit comments

Comments
 (0)