Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ STRIPE_SECRET_KEY=xxxx
STRIPE_WEBHOOK_SECRET=xxxx
STRIPE_PRICE_ID=xxxx
# end: stripe #

SENTRY_ORG=
SENTRY_PROJECT=
SENTRY_AUTH_TOKEN=
NEXT_PUBLIC_SENTRY_DSN=
2 changes: 1 addition & 1 deletion .internal/setup/db.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { spawn } from "node:child_process";
export async function generateMigrationFiles() {
const commands = [
"pnpm db:up",
"pnpm db:migrate --name initial-migration",
"pnpm db:migrate --name initial",
"pnpm generate:client",
"docker compose down",
];
Expand Down
5 changes: 1 addition & 4 deletions .internal/setup/questions/otel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
removeWords,
} from "../utils.mjs";

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

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

Expand Down
72 changes: 42 additions & 30 deletions .internal/tests/common.test.mjs.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ exports[`common > should put files 1`] = `
"internal-tests-output-common/knip.config.ts",
"internal-tests-output-common/lefthook.yml",
"internal-tests-output-common/next.config.ts",
"internal-tests-output-common/otel-collector-config.yml",
"internal-tests-output-common/package.json",
"internal-tests-output-common/playwright.config.ts",
"internal-tests-output-common/pnpm-lock.yaml",
Expand Down Expand Up @@ -82,6 +81,11 @@ exports[`common > should update .env.sample 1`] = `
"STRIPE_SECRET_KEY=xxxx",
"STRIPE_WEBHOOK_SECRET=xxxx",
"STRIPE_PRICE_ID=xxxx",
"",
"SENTRY_ORG=",
"SENTRY_PROJECT=",
"SENTRY_AUTH_TOKEN=",
"NEXT_PUBLIC_SENTRY_DSN=",
""
]
`;
Expand Down Expand Up @@ -429,30 +433,6 @@ exports[`common > should update compose.yml 1`] = `
" interval: 1s",
" timeout: 5s",
" retries: 10",
" jaeger:",
" image: jaegertracing/all-in-one",
" ports:",
" # https://www.jaegertracing.io/docs/1.6/getting-started/#all-in-one-docker-image",
" # frontend",
" - 16686:16686",
" - 14268",
" - 14250",
" environment:",
" - METRICS_STORAGE_TYPE=prometheus",
" - PROMETHEUS_QUERY_SUPPORT_SPANMETRICS_CONNECTOR=true",
" - COLLECTOR_OTLP_ENABLED=true",
" # don't use contrib on prod",
" # https://opentelemetry.io/blog/2024/otel-collector-anti-patterns/#3--not-using-the-right-collector-distribution-or-not-building-your-own-distribution",
" otel-collector:",
" image: otel/opentelemetry-collector-contrib",
" command: [\\"--config=/conf/otel-collector-config.yml\\"]",
" volumes:",
" - ./otel-collector-config.yml:/conf/otel-collector-config.yml",
" ports:",
" - 13133:13133 # health_check extension",
" - 4317:4317 # OTLP gRPC receiver",
" depends_on:",
" - jaeger",
""
]
`;
Expand All @@ -473,6 +453,8 @@ exports[`common > should update dependencies 1`] = `
"@opentelemetry/semantic-conventions",
"@prisma/client",
"@prisma/instrumentation",
"@sentry/nextjs",
"@sentry/profiling-node",
"clsx",
"next",
"next-auth",
Expand Down Expand Up @@ -798,6 +780,11 @@ exports[`common > should update env.ts 1`] = `
" STRIPE_PRICE_ID: z.string().min(1),",
" STRIPE_SECRET_KEY: z.string().min(1),",
" STRIPE_WEBHOOK_SECRET: z.string().min(1),",
"",
" SENTRY_ORG: z.string().min(1).optional().or(z.literal(\\"\\")),",
" SENTRY_PROJECT: z.string().min(1).optional().or(z.literal(\\"\\")),",
" SENTRY_AUTH_TOKEN: z.string().min(1).optional().or(z.literal(\\"\\")),",
" NEXT_PUBLIC_SENTRY_DSN: z.string().min(1).optional().or(z.literal(\\"\\")),",
"});",
"",
"const runtimeEnv = z.object({});",
Expand Down Expand Up @@ -847,6 +834,7 @@ exports[`common > should update knip.config.ts 1`] = `

exports[`common > should update next.config.ts 1`] = `
[
"import { withSentryConfig } from \\"@sentry/nextjs\\";",
"import type { NextConfig } from \\"next\\";",
"import { config } from \\"./env\\";",
"",
Expand Down Expand Up @@ -880,6 +868,15 @@ exports[`common > should update next.config.ts 1`] = `
" },",
" ],",
" },",
" {",
" source: \\"/:path*\\",",
" headers: [",
" {",
" key: \\"Document-Policy\\",",
" value: \\"js-profiling\\",",
" },",
" ],",
" },",
" ];",
" },",
" images: {",
Expand Down Expand Up @@ -910,7 +907,17 @@ exports[`common > should update next.config.ts 1`] = `
" ],",
"};",
"",
"export default nextConfig;",
"export default withSentryConfig(nextConfig, {",
" org: process.env.SENTRY_ORG,",
" project: process.env.SENTRY_PROJECT,",
" silent: !process.env.CI,",
" widenClientFileUpload: true,",
" authToken: process.env.SENTRY_AUTH_TOKEN,",
" disableLogger: true,",
" reactComponentAnnotation: {",
" enabled: true,",
" },",
"});",
""
]
`;
Expand Down Expand Up @@ -1068,6 +1075,7 @@ exports[`common > should update src/app/layout.tsx 1`] = `
"import { Inter } from \\"next/font/google\\";",
"import { Footer } from \\"./_components/Footer\\";",
"import { Header } from \\"./_components/Header\\";",
"import { SentryProvider } from \\"./_providers/Sentry\\";",
"import \\"./globals.css\\";",
"",
"const inter = Inter({",
Expand All @@ -1090,16 +1098,20 @@ exports[`common > should update src/app/layout.tsx 1`] = `
"",
"export default function Layout({ children }: LayoutProps<\\"/\\">) {",
" return (",
" <html lang=\\"en\\">",
" <html lang=\\"en\\" suppressHydrationWarning>",
" <body",
" // Extensions like Grammarly mutate <body> attributes before hydration.",
" suppressHydrationWarning",
" className={clsx(",
" inter.className,",
" \\"bg-gray-700 text-gray-200 min-h-screen flex flex-col\\",",
" )}",
" >",
" <Header />",
" <main className=\\"flex-1\\">{children}</main>",
" <Footer />",
" <SentryProvider>",
" <Header />",
" <main className=\\"flex-1\\">{children}</main>",
" <Footer />",
" </SentryProvider>",
" </body>",
" </html>",
" );",
Expand Down
1 change: 0 additions & 1 deletion .internal/tests/no-docker.test.mjs.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports[`no-docker > should put files 1`] = `
"internal-tests-output-no-docker/knip.config.ts",
"internal-tests-output-no-docker/lefthook.yml",
"internal-tests-output-no-docker/next.config.ts",
"internal-tests-output-no-docker/otel-collector-config.yml",
"internal-tests-output-no-docker/package.json",
"internal-tests-output-no-docker/playwright.config.ts",
"internal-tests-output-no-docker/pnpm-lock.yaml",
Expand Down
3 changes: 2 additions & 1 deletion .internal/tests/no-e2e.test.mjs.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ exports[`no-e2e > should put files 1`] = `
"internal-tests-output-no-e2e/knip.config.ts",
"internal-tests-output-no-e2e/lefthook.yml",
"internal-tests-output-no-e2e/next.config.ts",
"internal-tests-output-no-e2e/otel-collector-config.yml",
"internal-tests-output-no-e2e/package.json",
"internal-tests-output-no-e2e/pnpm-lock.yaml",
"internal-tests-output-no-e2e/pnpm-workspace.yaml",
Expand Down Expand Up @@ -271,6 +270,8 @@ exports[`no-e2e > should update dependencies 1`] = `
"@opentelemetry/semantic-conventions",
"@prisma/client",
"@prisma/instrumentation",
"@sentry/nextjs",
"@sentry/profiling-node",
"clsx",
"next",
"next-auth",
Expand Down
34 changes: 33 additions & 1 deletion .internal/tests/no-otel.test.mjs.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ exports[`no-otel > should update .env.sample 1`] = `
"STRIPE_SECRET_KEY=xxxx",
"STRIPE_WEBHOOK_SECRET=xxxx",
"STRIPE_PRICE_ID=xxxx",
"",
"SENTRY_ORG=",
"SENTRY_PROJECT=",
"SENTRY_AUTH_TOKEN=",
"NEXT_PUBLIC_SENTRY_DSN=",
""
]
`;
Expand Down Expand Up @@ -394,6 +399,8 @@ exports[`no-otel > should update dependencies 1`] = `
"@hookform/resolvers",
"@next/env",
"@prisma/client",
"@sentry/nextjs",
"@sentry/profiling-node",
"clsx",
"next",
"next-auth",
Expand Down Expand Up @@ -460,6 +467,11 @@ exports[`no-otel > should update env.ts 1`] = `
" STRIPE_PRICE_ID: z.string().min(1),",
" STRIPE_SECRET_KEY: z.string().min(1),",
" STRIPE_WEBHOOK_SECRET: z.string().min(1),",
"",
" SENTRY_ORG: z.string().min(1).optional().or(z.literal(\\"\\")),",
" SENTRY_PROJECT: z.string().min(1).optional().or(z.literal(\\"\\")),",
" SENTRY_AUTH_TOKEN: z.string().min(1).optional().or(z.literal(\\"\\")),",
" NEXT_PUBLIC_SENTRY_DSN: z.string().min(1).optional().or(z.literal(\\"\\")),",
"});",
"",
"const runtimeEnv = z.object({});",
Expand Down Expand Up @@ -487,6 +499,7 @@ exports[`no-otel > should update env.ts 1`] = `

exports[`no-otel > should update next.config.ts 1`] = `
[
"import { withSentryConfig } from \\"@sentry/nextjs\\";",
"import type { NextConfig } from \\"next\\";",
"import { config } from \\"./env\\";",
"",
Expand Down Expand Up @@ -520,6 +533,15 @@ exports[`no-otel > should update next.config.ts 1`] = `
" },",
" ],",
" },",
" {",
" source: \\"/:path*\\",",
" headers: [",
" {",
" key: \\"Document-Policy\\",",
" value: \\"js-profiling\\",",
" },",
" ],",
" },",
" ];",
" },",
" images: {",
Expand All @@ -539,7 +561,17 @@ exports[`no-otel > should update next.config.ts 1`] = `
" },",
"};",
"",
"export default nextConfig;",
"export default withSentryConfig(nextConfig, {",
" org: process.env.SENTRY_ORG,",
" project: process.env.SENTRY_PROJECT,",
" silent: !process.env.CI,",
" widenClientFileUpload: true,",
" authToken: process.env.SENTRY_AUTH_TOKEN,",
" disableLogger: true,",
" reactComponentAnnotation: {",
" enabled: true,",
" },",
"});",
""
]
`;
30 changes: 28 additions & 2 deletions .internal/tests/no-sample-code.test.mjs.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`no-sample-code > should put files 1`] = `
"internal-tests-output-no-sample-code/knip.config.ts",
"internal-tests-output-no-sample-code/lefthook.yml",
"internal-tests-output-no-sample-code/next.config.ts",
"internal-tests-output-no-sample-code/otel-collector-config.yml",
"internal-tests-output-no-sample-code/package.json",
"internal-tests-output-no-sample-code/playwright.config.ts",
"internal-tests-output-no-sample-code/pnpm-lock.yaml",
Expand All @@ -68,6 +67,7 @@ exports[`no-sample-code > should put files 1`] = `
"internal-tests-output-no-sample-code/src/app/_clients/nextAuth.ts",
"internal-tests-output-no-sample-code/src/app/_clients/nextAuthConfig.ts",
"internal-tests-output-no-sample-code/src/app/_clients/prisma.ts",
"internal-tests-output-no-sample-code/src/app/_clients/sentry.ts",
"internal-tests-output-no-sample-code/src/app/_clients/stripe.ts",
"internal-tests-output-no-sample-code/src/app/_components/AuthButtons.tsx",
"internal-tests-output-no-sample-code/src/app/_components/Button.tsx",
Expand All @@ -79,6 +79,7 @@ exports[`no-sample-code > should put files 1`] = `
"internal-tests-output-no-sample-code/src/app/_components/Input.tsx",
"internal-tests-output-no-sample-code/src/app/_hooks/useFormId.test.ts",
"internal-tests-output-no-sample-code/src/app/_hooks/useFormId.ts",
"internal-tests-output-no-sample-code/src/app/_providers/Sentry.tsx",
"internal-tests-output-no-sample-code/src/app/_schemas/users.test.ts",
"internal-tests-output-no-sample-code/src/app/_schemas/users.ts",
"internal-tests-output-no-sample-code/src/app/_types/result.ts",
Expand All @@ -90,6 +91,7 @@ exports[`no-sample-code > should put files 1`] = `
"internal-tests-output-no-sample-code/src/app/_utils/db.ts",
"internal-tests-output-no-sample-code/src/app/_utils/payment.test.ts",
"internal-tests-output-no-sample-code/src/app/_utils/payment.ts",
"internal-tests-output-no-sample-code/src/app/_utils/sentry.ts",
"internal-tests-output-no-sample-code/src/app/_utils/zod.test.ts",
"internal-tests-output-no-sample-code/src/app/_utils/zod.ts",
"internal-tests-output-no-sample-code/src/app/api/auth/[...nextauth]/route.ts",
Expand All @@ -105,10 +107,14 @@ exports[`no-sample-code > should put files 1`] = `
"internal-tests-output-no-sample-code/src/app/layout.tsx",
"internal-tests-output-no-sample-code/src/app/not-found.tsx",
"internal-tests-output-no-sample-code/src/app/robots.txt",
"internal-tests-output-no-sample-code/src/instrumentation-client.ts",
"internal-tests-output-no-sample-code/src/instrumentation.ts",
"internal-tests-output-no-sample-code/src/middleware.test.ts",
"internal-tests-output-no-sample-code/src/middleware.ts",
"internal-tests-output-no-sample-code/src/otel/instrumentations.ts",
"internal-tests-output-no-sample-code/src/otel/node.ts",
"internal-tests-output-no-sample-code/src/sentry.edge.config.ts",
"internal-tests-output-no-sample-code/src/sentry.server.config.ts",
"internal-tests-output-no-sample-code/tests/db.setup.ts",
"internal-tests-output-no-sample-code/tests/vitest.helper.ts",
"internal-tests-output-no-sample-code/tests/vitest.setup.ts",
Expand Down Expand Up @@ -298,6 +304,7 @@ exports[`no-sample-code > should update e2e/models/TopPage.ts 1`] = `

exports[`no-sample-code > should update next.config.ts 1`] = `
[
"import { withSentryConfig } from \\"@sentry/nextjs\\";",
"import type { NextConfig } from \\"next\\";",
"import { config } from \\"./env\\";",
"",
Expand Down Expand Up @@ -331,6 +338,15 @@ exports[`no-sample-code > should update next.config.ts 1`] = `
" },",
" ],",
" },",
" {",
" source: \\"/:path*\\",",
" headers: [",
" {",
" key: \\"Document-Policy\\",",
" value: \\"js-profiling\\",",
" },",
" ],",
" },",
" ];",
" },",
" typedRoutes: true,",
Expand All @@ -353,7 +369,17 @@ exports[`no-sample-code > should update next.config.ts 1`] = `
" ],",
"};",
"",
"export default nextConfig;",
"export default withSentryConfig(nextConfig, {",
" org: process.env.SENTRY_ORG,",
" project: process.env.SENTRY_PROJECT,",
" silent: !process.env.CI,",
" widenClientFileUpload: true,",
" authToken: process.env.SENTRY_AUTH_TOKEN,",
" disableLogger: true,",
" reactComponentAnnotation: {",
" enabled: true,",
" },",
"});",
""
]
`;
Expand Down
Loading
Loading