Skip to content

Commit a6dec71

Browse files
committed
wip
1 parent d4ef311 commit a6dec71

31 files changed

+2013
-273
lines changed

.env.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ STRIPE_SECRET_KEY=xxxx
3838
STRIPE_WEBHOOK_SECRET=xxxx
3939
STRIPE_PRICE_ID=xxxx
4040
# end: stripe #
41+
42+
SENTRY_ORG=
43+
SENTRY_PROJECT=
44+
SENTRY_AUTH_TOKEN=
45+
NEXT_PUBLIC_SENTRY_DSN=

.internal/setup/db.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { spawn } from "node:child_process";
33
export async function generateMigrationFiles() {
44
const commands = [
55
"pnpm db:up",
6-
"pnpm db:migrate --name initial-migration",
6+
"pnpm db:migrate --name initial",
77
"pnpm generate:client",
88
"docker compose down",
99
];

.internal/setup/questions/otel.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import {
77
removeWords,
88
} from "../utils.mjs";
99

10-
export const removedFiles = /** @type {const} */ ([
11-
"otel-collector-config.yml",
12-
"./src/instrumentation.ts",
13-
]);
10+
export const removedFiles = /** @type {const} */ (["./src/instrumentation.ts"]);
1411

1512
export const removedDirs = /** @type {const} */ (["./src/otel"]);
1613

.internal/tests/common.test.mjs.snapshot

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ exports[`common > should put files 1`] = `
2222
"internal-tests-output-common/knip.config.ts",
2323
"internal-tests-output-common/lefthook.yml",
2424
"internal-tests-output-common/next.config.ts",
25-
"internal-tests-output-common/otel-collector-config.yml",
2625
"internal-tests-output-common/package.json",
2726
"internal-tests-output-common/playwright.config.ts",
2827
"internal-tests-output-common/pnpm-lock.yaml",
@@ -82,6 +81,11 @@ exports[`common > should update .env.sample 1`] = `
8281
"STRIPE_SECRET_KEY=xxxx",
8382
"STRIPE_WEBHOOK_SECRET=xxxx",
8483
"STRIPE_PRICE_ID=xxxx",
84+
"",
85+
"SENTRY_ORG=",
86+
"SENTRY_PROJECT=",
87+
"SENTRY_AUTH_TOKEN=",
88+
"NEXT_PUBLIC_SENTRY_DSN=",
8589
""
8690
]
8791
`;
@@ -427,30 +431,6 @@ exports[`common > should update compose.yml 1`] = `
427431
" interval: 1s",
428432
" timeout: 5s",
429433
" retries: 10",
430-
" jaeger:",
431-
" image: jaegertracing/all-in-one",
432-
" ports:",
433-
" # https://www.jaegertracing.io/docs/1.6/getting-started/#all-in-one-docker-image",
434-
" # frontend",
435-
" - 16686:16686",
436-
" - 14268",
437-
" - 14250",
438-
" environment:",
439-
" - METRICS_STORAGE_TYPE=prometheus",
440-
" - PROMETHEUS_QUERY_SUPPORT_SPANMETRICS_CONNECTOR=true",
441-
" - COLLECTOR_OTLP_ENABLED=true",
442-
" # don't use contrib on prod",
443-
" # https://opentelemetry.io/blog/2024/otel-collector-anti-patterns/#3--not-using-the-right-collector-distribution-or-not-building-your-own-distribution",
444-
" otel-collector:",
445-
" image: otel/opentelemetry-collector-contrib",
446-
" command: [\\"--config=/conf/otel-collector-config.yml\\"]",
447-
" volumes:",
448-
" - ./otel-collector-config.yml:/conf/otel-collector-config.yml",
449-
" ports:",
450-
" - 13133:13133 # health_check extension",
451-
" - 4317:4317 # OTLP gRPC receiver",
452-
" depends_on:",
453-
" - jaeger",
454434
""
455435
]
456436
`;
@@ -471,6 +451,8 @@ exports[`common > should update dependencies 1`] = `
471451
"@opentelemetry/semantic-conventions",
472452
"@prisma/client",
473453
"@prisma/instrumentation",
454+
"@sentry/nextjs",
455+
"@sentry/profiling-node",
474456
"clsx",
475457
"next",
476458
"next-auth",
@@ -795,6 +777,11 @@ exports[`common > should update env.ts 1`] = `
795777
" STRIPE_PRICE_ID: z.string().min(1),",
796778
" STRIPE_SECRET_KEY: z.string().min(1),",
797779
" STRIPE_WEBHOOK_SECRET: z.string().min(1),",
780+
"",
781+
" SENTRY_ORG: z.string().min(1).optional().or(z.literal(\\"\\")),",
782+
" SENTRY_PROJECT: z.string().min(1).optional().or(z.literal(\\"\\")),",
783+
" SENTRY_AUTH_TOKEN: z.string().min(1).optional().or(z.literal(\\"\\")),",
784+
" NEXT_PUBLIC_SENTRY_DSN: z.string().min(1).optional().or(z.literal(\\"\\")),",
798785
"});",
799786
"",
800787
"const runtimeEnv = z.object({});",
@@ -844,6 +831,7 @@ exports[`common > should update knip.config.ts 1`] = `
844831

845832
exports[`common > should update next.config.ts 1`] = `
846833
[
834+
"import { withSentryConfig } from \\"@sentry/nextjs\\";",
847835
"import type { NextConfig } from \\"next\\";",
848836
"import { config } from \\"./env\\";",
849837
"",
@@ -877,6 +865,15 @@ exports[`common > should update next.config.ts 1`] = `
877865
" },",
878866
" ],",
879867
" },",
868+
" {",
869+
" source: \\"/:path*\\",",
870+
" headers: [",
871+
" {",
872+
" key: \\"Document-Policy\\",",
873+
" value: \\"js-profiling\\",",
874+
" },",
875+
" ],",
876+
" },",
880877
" ];",
881878
" },",
882879
" images: {",
@@ -907,7 +904,17 @@ exports[`common > should update next.config.ts 1`] = `
907904
" ],",
908905
"};",
909906
"",
910-
"export default nextConfig;",
907+
"export default withSentryConfig(nextConfig, {",
908+
" org: process.env.SENTRY_ORG,",
909+
" project: process.env.SENTRY_PROJECT,",
910+
" silent: !process.env.CI,",
911+
" widenClientFileUpload: true,",
912+
" authToken: process.env.SENTRY_AUTH_TOKEN,",
913+
" disableLogger: true,",
914+
" reactComponentAnnotation: {",
915+
" enabled: true,",
916+
" },",
917+
"});",
911918
""
912919
]
913920
`;
@@ -1065,6 +1072,7 @@ exports[`common > should update src/app/layout.tsx 1`] = `
10651072
"import { Inter } from \\"next/font/google\\";",
10661073
"import { Footer } from \\"./_components/Footer\\";",
10671074
"import { Header } from \\"./_components/Header\\";",
1075+
"import { SentryProvider } from \\"./_providers/Sentry\\";",
10681076
"import \\"./globals.css\\";",
10691077
"",
10701078
"const inter = Inter({",
@@ -1085,28 +1093,22 @@ exports[`common > should update src/app/layout.tsx 1`] = `
10851093
" maximumScale: 1,",
10861094
"};",
10871095
"",
1088-
<<<<<<< HEAD
10891096
"export default function Layout({ children }: LayoutProps<\\"/\\">) {",
1090-
||||||| parent of da30f8f (refactor: clean up)
1091-
"type Props = PropsWithChildren<{",
1092-
" dialog: ReactNode;",
1093-
"}>;",
1094-
"",
1095-
"export default function Layout({ dialog, children }: Props) {",
1096-
=======
1097-
"export default function Layout({ dialog, children }: LayoutProps<\\"/\\">) {",
1098-
>>>>>>> da30f8f (refactor: clean up)
10991097
" return (",
1100-
" <html lang=\\"en\\">",
1098+
" <html lang=\\"en\\" suppressHydrationWarning>",
11011099
" <body",
1100+
" // Extensions like Grammarly mutate <body> attributes before hydration.",
1101+
" suppressHydrationWarning",
11021102
" className={clsx(",
11031103
" inter.className,",
11041104
" \\"bg-gray-700 text-gray-200 min-h-screen flex flex-col\\",",
11051105
" )}",
11061106
" >",
1107-
" <Header />",
1108-
" <main className=\\"flex-1\\">{children}</main>",
1109-
" <Footer />",
1107+
" <SentryProvider>",
1108+
" <Header />",
1109+
" <main className=\\"flex-1\\">{children}</main>",
1110+
" <Footer />",
1111+
" </SentryProvider>",
11101112
" </body>",
11111113
" </html>",
11121114
" );",

.internal/tests/no-docker.test.mjs.snapshot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ exports[`no-docker > should put files 1`] = `
2020
"internal-tests-output-no-docker/knip.config.ts",
2121
"internal-tests-output-no-docker/lefthook.yml",
2222
"internal-tests-output-no-docker/next.config.ts",
23-
"internal-tests-output-no-docker/otel-collector-config.yml",
2423
"internal-tests-output-no-docker/package.json",
2524
"internal-tests-output-no-docker/playwright.config.ts",
2625
"internal-tests-output-no-docker/pnpm-lock.yaml",

.internal/tests/no-e2e.test.mjs.snapshot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ exports[`no-e2e > should put files 1`] = `
2222
"internal-tests-output-no-e2e/knip.config.ts",
2323
"internal-tests-output-no-e2e/lefthook.yml",
2424
"internal-tests-output-no-e2e/next.config.ts",
25-
"internal-tests-output-no-e2e/otel-collector-config.yml",
2625
"internal-tests-output-no-e2e/package.json",
2726
"internal-tests-output-no-e2e/pnpm-lock.yaml",
2827
"internal-tests-output-no-e2e/pnpm-workspace.yaml",
@@ -271,6 +270,8 @@ exports[`no-e2e > should update dependencies 1`] = `
271270
"@opentelemetry/semantic-conventions",
272271
"@prisma/client",
273272
"@prisma/instrumentation",
273+
"@sentry/nextjs",
274+
"@sentry/profiling-node",
274275
"clsx",
275276
"next",
276277
"next-auth",

.internal/tests/no-otel.test.mjs.snapshot

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ exports[`no-otel > should update .env.sample 1`] = `
7979
"STRIPE_SECRET_KEY=xxxx",
8080
"STRIPE_WEBHOOK_SECRET=xxxx",
8181
"STRIPE_PRICE_ID=xxxx",
82+
"",
83+
"SENTRY_ORG=",
84+
"SENTRY_PROJECT=",
85+
"SENTRY_AUTH_TOKEN=",
86+
"NEXT_PUBLIC_SENTRY_DSN=",
8287
""
8388
]
8489
`;
@@ -392,6 +397,8 @@ exports[`no-otel > should update dependencies 1`] = `
392397
"@hookform/resolvers",
393398
"@next/env",
394399
"@prisma/client",
400+
"@sentry/nextjs",
401+
"@sentry/profiling-node",
395402
"clsx",
396403
"next",
397404
"next-auth",
@@ -458,6 +465,11 @@ exports[`no-otel > should update env.ts 1`] = `
458465
" STRIPE_PRICE_ID: z.string().min(1),",
459466
" STRIPE_SECRET_KEY: z.string().min(1),",
460467
" STRIPE_WEBHOOK_SECRET: z.string().min(1),",
468+
"",
469+
" SENTRY_ORG: z.string().min(1).optional().or(z.literal(\\"\\")),",
470+
" SENTRY_PROJECT: z.string().min(1).optional().or(z.literal(\\"\\")),",
471+
" SENTRY_AUTH_TOKEN: z.string().min(1).optional().or(z.literal(\\"\\")),",
472+
" NEXT_PUBLIC_SENTRY_DSN: z.string().min(1).optional().or(z.literal(\\"\\")),",
461473
"});",
462474
"",
463475
"const runtimeEnv = z.object({});",
@@ -485,6 +497,7 @@ exports[`no-otel > should update env.ts 1`] = `
485497

486498
exports[`no-otel > should update next.config.ts 1`] = `
487499
[
500+
"import { withSentryConfig } from \\"@sentry/nextjs\\";",
488501
"import type { NextConfig } from \\"next\\";",
489502
"import { config } from \\"./env\\";",
490503
"",
@@ -518,6 +531,15 @@ exports[`no-otel > should update next.config.ts 1`] = `
518531
" },",
519532
" ],",
520533
" },",
534+
" {",
535+
" source: \\"/:path*\\",",
536+
" headers: [",
537+
" {",
538+
" key: \\"Document-Policy\\",",
539+
" value: \\"js-profiling\\",",
540+
" },",
541+
" ],",
542+
" },",
521543
" ];",
522544
" },",
523545
" images: {",
@@ -537,7 +559,17 @@ exports[`no-otel > should update next.config.ts 1`] = `
537559
" },",
538560
"};",
539561
"",
540-
"export default nextConfig;",
562+
"export default withSentryConfig(nextConfig, {",
563+
" org: process.env.SENTRY_ORG,",
564+
" project: process.env.SENTRY_PROJECT,",
565+
" silent: !process.env.CI,",
566+
" widenClientFileUpload: true,",
567+
" authToken: process.env.SENTRY_AUTH_TOKEN,",
568+
" disableLogger: true,",
569+
" reactComponentAnnotation: {",
570+
" enabled: true,",
571+
" },",
572+
"});",
541573
""
542574
]
543575
`;

.internal/tests/no-sample-code.test.mjs.snapshot

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ exports[`no-sample-code > should put files 1`] = `
4141
"internal-tests-output-no-sample-code/knip.config.ts",
4242
"internal-tests-output-no-sample-code/lefthook.yml",
4343
"internal-tests-output-no-sample-code/next.config.ts",
44-
"internal-tests-output-no-sample-code/otel-collector-config.yml",
4544
"internal-tests-output-no-sample-code/package.json",
4645
"internal-tests-output-no-sample-code/playwright.config.ts",
4746
"internal-tests-output-no-sample-code/pnpm-lock.yaml",
@@ -68,6 +67,7 @@ exports[`no-sample-code > should put files 1`] = `
6867
"internal-tests-output-no-sample-code/src/app/_clients/nextAuth.ts",
6968
"internal-tests-output-no-sample-code/src/app/_clients/nextAuthConfig.ts",
7069
"internal-tests-output-no-sample-code/src/app/_clients/prisma.ts",
70+
"internal-tests-output-no-sample-code/src/app/_clients/sentry.ts",
7171
"internal-tests-output-no-sample-code/src/app/_clients/stripe.ts",
7272
"internal-tests-output-no-sample-code/src/app/_components/AuthButtons.tsx",
7373
"internal-tests-output-no-sample-code/src/app/_components/Button.tsx",
@@ -79,6 +79,7 @@ exports[`no-sample-code > should put files 1`] = `
7979
"internal-tests-output-no-sample-code/src/app/_components/Input.tsx",
8080
"internal-tests-output-no-sample-code/src/app/_hooks/useFormId.test.ts",
8181
"internal-tests-output-no-sample-code/src/app/_hooks/useFormId.ts",
82+
"internal-tests-output-no-sample-code/src/app/_providers/Sentry.tsx",
8283
"internal-tests-output-no-sample-code/src/app/_schemas/users.test.ts",
8384
"internal-tests-output-no-sample-code/src/app/_schemas/users.ts",
8485
"internal-tests-output-no-sample-code/src/app/_types/result.ts",
@@ -90,6 +91,7 @@ exports[`no-sample-code > should put files 1`] = `
9091
"internal-tests-output-no-sample-code/src/app/_utils/db.ts",
9192
"internal-tests-output-no-sample-code/src/app/_utils/payment.test.ts",
9293
"internal-tests-output-no-sample-code/src/app/_utils/payment.ts",
94+
"internal-tests-output-no-sample-code/src/app/_utils/sentry.ts",
9395
"internal-tests-output-no-sample-code/src/app/_utils/zod.test.ts",
9496
"internal-tests-output-no-sample-code/src/app/_utils/zod.ts",
9597
"internal-tests-output-no-sample-code/src/app/api/auth/[...nextauth]/route.ts",
@@ -105,10 +107,14 @@ exports[`no-sample-code > should put files 1`] = `
105107
"internal-tests-output-no-sample-code/src/app/layout.tsx",
106108
"internal-tests-output-no-sample-code/src/app/not-found.tsx",
107109
"internal-tests-output-no-sample-code/src/app/robots.txt",
110+
"internal-tests-output-no-sample-code/src/instrumentation-client.ts",
108111
"internal-tests-output-no-sample-code/src/instrumentation.ts",
109112
"internal-tests-output-no-sample-code/src/middleware.test.ts",
110113
"internal-tests-output-no-sample-code/src/middleware.ts",
114+
"internal-tests-output-no-sample-code/src/otel/instrumentations.ts",
111115
"internal-tests-output-no-sample-code/src/otel/node.ts",
116+
"internal-tests-output-no-sample-code/src/sentry.edge.config.ts",
117+
"internal-tests-output-no-sample-code/src/sentry.server.config.ts",
112118
"internal-tests-output-no-sample-code/tests/db.setup.ts",
113119
"internal-tests-output-no-sample-code/tests/vitest.helper.ts",
114120
"internal-tests-output-no-sample-code/tests/vitest.setup.ts",
@@ -298,6 +304,7 @@ exports[`no-sample-code > should update e2e/models/TopPage.ts 1`] = `
298304

299305
exports[`no-sample-code > should update next.config.ts 1`] = `
300306
[
307+
"import { withSentryConfig } from \\"@sentry/nextjs\\";",
301308
"import type { NextConfig } from \\"next\\";",
302309
"import { config } from \\"./env\\";",
303310
"",
@@ -331,6 +338,15 @@ exports[`no-sample-code > should update next.config.ts 1`] = `
331338
" },",
332339
" ],",
333340
" },",
341+
" {",
342+
" source: \\"/:path*\\",",
343+
" headers: [",
344+
" {",
345+
" key: \\"Document-Policy\\",",
346+
" value: \\"js-profiling\\",",
347+
" },",
348+
" ],",
349+
" },",
334350
" ];",
335351
" },",
336352
" typedRoutes: true,",
@@ -353,7 +369,17 @@ exports[`no-sample-code > should update next.config.ts 1`] = `
353369
" ],",
354370
"};",
355371
"",
356-
"export default nextConfig;",
372+
"export default withSentryConfig(nextConfig, {",
373+
" org: process.env.SENTRY_ORG,",
374+
" project: process.env.SENTRY_PROJECT,",
375+
" silent: !process.env.CI,",
376+
" widenClientFileUpload: true,",
377+
" authToken: process.env.SENTRY_AUTH_TOKEN,",
378+
" disableLogger: true,",
379+
" reactComponentAnnotation: {",
380+
" enabled: true,",
381+
" },",
382+
"});",
357383
""
358384
]
359385
`;

0 commit comments

Comments
 (0)