Update env stuff because I don't think it was all working right.

This commit is contained in:
2026-03-21 16:07:50 -05:00
parent 0ecf6238de
commit ee99ab11c9
6 changed files with 38 additions and 66 deletions

View File

@@ -1,11 +1,10 @@
import { env } from '@/env.js';
import { withSentryConfig } from '@sentry/nextjs'; import { withSentryConfig } from '@sentry/nextjs';
import { withPlausibleProxy } from 'next-plausible'; import { withPlausibleProxy } from 'next-plausible';
import { env } from '@/env';
/** @type {import("next").NextConfig} */ /** @type {import("next").NextConfig} */
const config = withPlausibleProxy({ const config = withPlausibleProxy({
customDomain: env.NEXT_PUBLIC_PLAUSIBLE_URL, customDomain: process.env.NEXT_PUBLIC_PLAUSIBLE_URL,
})({ })({
output: 'standalone', output: 'standalone',
images: { images: {
@@ -35,7 +34,7 @@ const sentryConfig = {
sentryUrl: env.NEXT_PUBLIC_SENTRY_URL, sentryUrl: env.NEXT_PUBLIC_SENTRY_URL,
authToken: env.SENTRY_AUTH_TOKEN, authToken: env.SENTRY_AUTH_TOKEN,
// Only print logs for uploading source maps in CI // Only print logs for uploading source maps in CI
silent: env.CI, silent: !env.CI,
// For all available options, see: // For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time) // Upload a larger set of source maps for prettier stack traces (increases build time)

View File

@@ -1,6 +1,6 @@
import type { Metadata, Viewport } from 'next'; import type { Metadata, Viewport } from 'next';
import { Geist, Geist_Mono } from 'next/font/google'; import { Geist, Geist_Mono } from 'next/font/google';
import { env } from '@/env'; import { env } from '@/env.js';
import '@/app/styles.css'; import '@/app/styles.css';

View File

@@ -2,18 +2,13 @@ import { createEnv } from '@t3-oss/env-nextjs';
import { z } from 'zod/v4'; import { z } from 'zod/v4';
export const env = createEnv({ export const env = createEnv({
shared: { server: {
NODE_ENV: z NODE_ENV: z
.enum(['development', 'production', 'test']) .enum(['development', 'production', 'test'])
.default('development'), .default('development'),
CI: z.boolean().default(false), SKIP_ENV_VALIDATION: z.boolean().default(false),
},
/**
* Specify your server-side environment variables schema here.
* This way you can ensure the app isn't built with invalid env vars.
*/
server: {
SENTRY_AUTH_TOKEN: z.string(), SENTRY_AUTH_TOKEN: z.string(),
CI: z.boolean().default(false),
}, },
/** /**
@@ -32,8 +27,10 @@ export const env = createEnv({
/** /**
* Destructure all variables from `process.env` to make sure they aren't tree-shaken away. * Destructure all variables from `process.env` to make sure they aren't tree-shaken away.
*/ */
experimental__runtimeEnv: { runtimeEnv: {
NODE_ENV: process.env.NODE_ENV, NODE_ENV: process.env.NODE_ENV,
SKIP_ENV_VALIDATION: process.env.SKIP_ENV_VALIDATION,
SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,
CI: process.env.CI, CI: process.env.CI,
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL, NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL,
NEXT_PUBLIC_CONVEX_URL: process.env.NEXT_PUBLIC_CONVEX_URL, NEXT_PUBLIC_CONVEX_URL: process.env.NEXT_PUBLIC_CONVEX_URL,
@@ -41,9 +38,8 @@ export const env = createEnv({
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN, NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
NEXT_PUBLIC_SENTRY_URL: process.env.NEXT_PUBLIC_SENTRY_URL, NEXT_PUBLIC_SENTRY_URL: process.env.NEXT_PUBLIC_SENTRY_URL,
NEXT_PUBLIC_SENTRY_ORG: process.env.NEXT_PUBLIC_SENTRY_ORG, NEXT_PUBLIC_SENTRY_ORG: process.env.NEXT_PUBLIC_SENTRY_ORG,
NEXT_PUBLIC_SENTRY_PROJECT_NAME: NEXT_PUBLIC_SENTRY_PROJECT_NAME: process.env.NEXT_PUBLIC_SENTRY_PROJECT_NAME,
process.env.NEXT_PUBLIC_SENTRY_PROJECT_NAME,
}, },
skipValidation: skipValidation: !!process.env.SKIP_ENV_VALIDATION,
!!process.env.CI || process.env.npm_lifecycle_event === 'lint', emptyStringAsUndefined: true,
}); });

View File

@@ -1,7 +1,6 @@
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ // https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from '@sentry/nextjs'; import * as Sentry from '@sentry/nextjs';
import { env } from '@/env.js';
import { env } from '@/env';
Sentry.init({ Sentry.init({
dsn: env.NEXT_PUBLIC_SENTRY_DSN, dsn: env.NEXT_PUBLIC_SENTRY_DSN,

View File

@@ -1,6 +1,5 @@
import * as Sentry from '@sentry/nextjs'; import * as Sentry from '@sentry/nextjs';
import { env } from '@/env.js';
import { env } from '@/env';
Sentry.init({ Sentry.init({
dsn: env.NEXT_PUBLIC_SENTRY_DSN, dsn: env.NEXT_PUBLIC_SENTRY_DSN,

View File

@@ -1,17 +1,9 @@
'use client'; 'use client';
import type { ComponentProps } from 'react'; import type { ComponentProps } from 'react';
import { Moon, Sun } from 'lucide-react';
import { ThemeProvider as NextThemesProvider, useTheme } from 'next-themes'; import { ThemeProvider as NextThemesProvider, useTheme } from 'next-themes';
import { Moon, Sun } from 'lucide-react';
import { import { Button, cn } from '@gib/ui';
Button,
cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@gib/ui';
const ThemeProvider = ({ const ThemeProvider = ({
@@ -27,41 +19,28 @@ interface ThemeToggleProps {
} }
const ThemeToggle = ({ size = 1, buttonProps }: ThemeToggleProps) => { const ThemeToggle = ({ size = 1, buttonProps }: ThemeToggleProps) => {
const { setTheme } = useTheme(); const { setTheme, resolvedTheme } = useTheme();
return ( return (
<DropdownMenu> <Button
<DropdownMenuTrigger asChild> variant="outline"
<Button size="icon"
variant="outline" onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}
size="icon" {...buttonProps}
{...buttonProps} className={cn('cursor-pointer', buttonProps?.className)}
className={cn('cursor-pointer', buttonProps?.className)} >
> <Sun
<Sun style={{ height: `${size}rem`, width: `${size}rem` }}
style={{ height: `${size}rem`, width: `${size}rem` }} className='scale-100 rotate-0 transition-all
className='scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90' dark:scale-0 dark:-rotate-90'
/> />
<Moon <Moon
style={{ height: `${size}rem`, width: `${size}rem` }} style={{ height: `${size}rem`, width: `${size}rem` }}
className='absolute scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0' className='absolute scale-0 rotate-90 transition-all
/> dark:scale-100 dark:rotate-0'
<span className="sr-only">Toggle theme</span> />
</Button> <span className="sr-only">Toggle theme</span>
</DropdownMenuTrigger> </Button>
<DropdownMenuContent align="end"> );
<DropdownMenuItem onClick={() => setTheme("light")}>
Light
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("dark")}>
Dark
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("system")}>
System
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}; };
export { ThemeProvider, ThemeToggle, type ThemeToggleProps }; export { ThemeProvider, ThemeToggle, type ThemeToggleProps };