Skip to content

Commit

Permalink
feat: modify how env are managed
Browse files Browse the repository at this point in the history
  • Loading branch information
thedaviddias committed Feb 25, 2025
1 parent 690c862 commit 2c0a11a
Show file tree
Hide file tree
Showing 107 changed files with 1,739 additions and 51,952 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,3 @@ jobs:
run: |
pnpm typecheck
pnpm check:links
build:
name: Build
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install

- name: Build
run: pnpm build
2 changes: 1 addition & 1 deletion apps/web/app/api/newsletter/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { env } from '@thedaviddias/config-environment'
import { logger } from '@thedaviddias/logging'
import { type NextRequest, NextResponse } from 'next/server'
import { env } from '../../../env'

export async function POST(req: NextRequest) {
try {
Expand Down
4 changes: 3 additions & 1 deletion apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { Header } from '@/components/layout/header'
import { PageTransition } from '@/components/page-transition'
import { fonts } from '@thedaviddias/design-system/lib/fonts'
import { DesignSystemProvider } from '@thedaviddias/design-system/theme-provider'
import { getBaseUrl } from '@thedaviddias/utils/get-base-url'

export const metadata: Metadata = {
title: 'llms.txt hub',
description: 'A curated hub for AI-ready documentation implementing the llms.txt standard'
description: 'A curated hub for AI-ready documentation implementing the llms.txt standard',
metadataBase: new URL(getBaseUrl())
}

type RootLayoutProps = {
Expand Down
4 changes: 3 additions & 1 deletion apps/web/components/auth/sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export function SignIn({ redirectUrl = '/', onSignIn, children }: SignInProps) {
const { user, signIn } = useAuth()
const router = useRouter()
const searchParams = useSearchParams()
const hasSupabaseConfig = Boolean(keys().url && keys().anonKey)
const hasSupabaseConfig = Boolean(
keys().NEXT_PUBLIC_SUPABASE_URL && keys().NEXT_PUBLIC_SUPABASE_ANON_KEY
)

useEffect(() => {
if (user) {
Expand Down
12 changes: 12 additions & 0 deletions apps/web/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createEnv } from '@t3-oss/env-nextjs'
import { keys as core } from '@thedaviddias/config-next/keys'
import { keys as logging } from '@thedaviddias/logging/keys'
import { keys as observability } from '@thedaviddias/observability/keys'
import { keys as supabase } from '@thedaviddias/supabase/keys'

export const env = createEnv({
extends: [core(), observability(), supabase(), logging()],
server: {},
client: {},
runtimeEnv: {}
})
3 changes: 3 additions & 0 deletions apps/web/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { initializeSentry } from '@thedaviddias/observability/instrumentation'

export const register = initializeSentry()
7 changes: 3 additions & 4 deletions apps/web/next.config.mjs → apps/web/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import { env } from '@/env'
import withMDX from '@next/mdx'
import { env } from '@thedaviddias/config-environment'
import {
baseConfig,
withAnalyzer,
withPlausibleProxyConfig,
withVercelToolbarConfig
} from '@thedaviddias/config-next'
import type { NextConfig } from 'next'

export const INTERNAL_PACKAGES = [
'@thedaviddias/design-system',
'@thedaviddias/analytics',
'@thedaviddias/auth',
'@thedaviddias/caching',
'@thedaviddias/config-environment',
'@thedaviddias/config-next',
'@thedaviddias/config-typescript',
'@thedaviddias/logging',
'@thedaviddias/supabase',
'@thedaviddias/utils'
]

/** @type {import('next').NextConfig} */
let nextConfig = {
let nextConfig: NextConfig = {
...baseConfig,

transpilePackages: INTERNAL_PACKAGES,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"@thedaviddias/analytics": "workspace:*",
"@thedaviddias/auth": "workspace:*",
"@thedaviddias/caching": "workspace:*",
"@thedaviddias/config-environment": "workspace:*",
"@thedaviddias/config-next": "workspace:*",
"@thedaviddias/config-typescript": "workspace:*",
"@thedaviddias/design-system": "workspace:*",
"@thedaviddias/hooks": "workspace:*",
"@thedaviddias/logging": "workspace:*",
"@thedaviddias/observability": "workspace:*",
"@thedaviddias/supabase": "workspace:*",
"@thedaviddias/utils": "workspace:*",
"cheerio": "^1.0.0",
Expand Down
3 changes: 1 addition & 2 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
}
],
"paths": {
"@/*": ["./*"],
"@thedaviddias/*": ["../*"]
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
Expand Down
Empty file removed configs/environment/README.md
Empty file.
43 changes: 0 additions & 43 deletions configs/environment/index.d.ts

This file was deleted.

92 changes: 0 additions & 92 deletions configs/environment/index.mjs

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions configs/environment/node_modules/@types/node/LICENSE

This file was deleted.

15 changes: 0 additions & 15 deletions configs/environment/node_modules/@types/node/README.md

This file was deleted.

Loading

0 comments on commit 2c0a11a

Please sign in to comment.