Skip to content

Commit

Permalink
refactor: no sentry because bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
ixahmedxi committed Jun 8, 2024
1 parent 44b20db commit 9458028
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 116 deletions.
6 changes: 0 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,3 @@ UPSTASH_REDIS_REST_TOKEN=<your-upstash-rest-token>

# Resend
RESEND_API_KEY=<your-resend-api-key>

# Sentry
NEXT_PUBLIC_SENTRY_DSN=<your-sentry-dsn>
SENTRY_ORG=<your-sentry-org>
SENTRY_PROJECT=<your-sentry-project>
SENTRY_AUTH_TOKEN=<your-sentry-auth-token>
6 changes: 0 additions & 6 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ jobs:
# Resend
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}

# Sentry
NEXT_PUBLIC_SENTRY_DSN: ${{ vars.NEXT_PUBLIC_SENTRY_DSN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ jobs:
# Resend
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}

# Sentry
NEXT_PUBLIC_SENTRY_DSN: ${{ vars.NEXT_PUBLIC_SENTRY_DSN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ The Tech Stack:
- [NeonDB](https://neon.tech)
- [Clerk Auth](https://clerk.dev/)
- [Upstash](https://upstash.com)
- [Sentry](https://sentry.io)
- [Resend](https://resend.com)

Development stuff:
Expand Down
Binary file modified bun.lockb
Binary file not shown.
17 changes: 6 additions & 11 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { fileURLToPath } from 'node:url';

import createJiti from 'jiti';
import { withSentryConfig } from '@sentry/nextjs';
import bundleAnalyzerPlugin from '@next/bundle-analyzer';

const jiti = createJiti(fileURLToPath(import.meta.url));

jiti('./src/env');

const withBundleAnalyzer = bundleAnalyzerPlugin({
enabled: process.env['ANALYZE'] === 'true',
});

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
Expand All @@ -26,13 +30,4 @@ const nextConfig = {
},
};

export default withSentryConfig(nextConfig, {
org: process.env['SENTRY_ORG'] ?? '',
project: process.env['SENTRY_PROJECT'] ?? '',
silent: !process.env['CI'],
widenClientFileUpload: true,
tunnelRoute: '/monitoring',
hideSourceMaps: true,
disableLogger: true,
automaticVercelMonitors: true,
});
export default withBundleAnalyzer(nextConfig);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@react-email/components": "^0.0.19",
"@sentry/nextjs": "^8.8.0",
"@t3-oss/env-nextjs": "^0.10.1",
"@tanstack/react-query": "^5.40.1",
"@trpc/client": "next",
Expand Down Expand Up @@ -107,6 +106,7 @@
"@eslint/js": "^9.4.0",
"@happy-dom/global-registrator": "^14.12.0",
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@next/bundle-analyzer": "^14.2.3",
"@next/eslint-plugin-next": "^14.2.3",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/container-queries": "^0.1.1",
Expand Down
16 changes: 0 additions & 16 deletions sentry.client.config.ts

This file was deleted.

8 changes: 0 additions & 8 deletions sentry.edge.config.ts

This file was deleted.

8 changes: 0 additions & 8 deletions sentry.server.config.ts

This file was deleted.

10 changes: 1 addition & 9 deletions src/app/(site)/early-access/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { TRPCReactProvider } from '@/lib/trpc/react';
import { ClerkProvider } from '@clerk/nextjs';
import { dark } from '@clerk/themes';
import type { PropsWithChildren } from 'react';

export default function EarlyAccessLayout({ children }: PropsWithChildren) {
return (
<ClerkProvider
appearance={{ baseTheme: dark, variables: { colorPrimary: '#F9617B' } }}
>
<TRPCReactProvider>{children}</TRPCReactProvider>
</ClerkProvider>
);
return <TRPCReactProvider>{children}</TRPCReactProvider>;
}
19 changes: 0 additions & 19 deletions src/app/global-error.jsx

This file was deleted.

9 changes: 0 additions & 9 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,16 @@ export const env = createEnv({

// Clerk
CLERK_SECRET_KEY: z.string(),

// Sentry
SENTRY_ORG: z.string(),
SENTRY_PROJECT: z.string(),
SENTRY_AUTH_TOKEN: z.string(),
},
client: {
// Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string(),

// Sentry
NEXT_PUBLIC_SENTRY_DSN: z.string().url(),
},

experimental__runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:
process.env['NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY'],
NEXT_PUBLIC_SENTRY_DSN: process.env['NEXT_PUBLIC_SENTRY_DSN'],
},

skipValidation: !!process.env['SKIP_ENV_VALIDATION'],
Expand Down
9 changes: 0 additions & 9 deletions src/instrumentation.ts

This file was deleted.

13 changes: 6 additions & 7 deletions src/server/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ import { db } from '@/db';
import { resend } from '@/lib/resend';
import { redis } from '@/lib/redis';

export const createTRPCContext = async (opts: { headers: Headers }) => {
const session = await currentUser();

export const createTRPCContext = (opts: { headers: Headers }) => {
return {
db,
resend,
redis,
session,
...opts,
};
};
Expand All @@ -37,14 +34,16 @@ export const createCallerFactory = t.createCallerFactory;
export const createRouter = t.router;
export const publicProcedure = t.procedure;

export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
if (!ctx.session) {
export const protectedProcedure = t.procedure.use(async ({ next }) => {
const session = await currentUser();

if (!session) {
throw new TRPCError({ code: 'UNAUTHORIZED' });
}

return next({
ctx: {
session: { ...ctx.session },
session: { ...session },
},
});
});

0 comments on commit 9458028

Please sign in to comment.