diff --git a/apps/website/src/app/api/draft/route.ts b/apps/website/src/app/api/draft/route.ts index f2458f8..4eeaa81 100644 --- a/apps/website/src/app/api/draft/route.ts +++ b/apps/website/src/app/api/draft/route.ts @@ -1,8 +1,7 @@ import { draftMode } from "next/headers"; import { redirect } from "next/navigation"; -import { z } from "zod"; -const DRAFT_MODE_SECRET = z.string().parse(process.env.DRAFT_MODE_SECRET); +const { DRAFT_MODE_SECRET } = process.env; export const GET = async (request: Request) => { const { searchParams } = new URL(request.url); diff --git a/apps/website/src/app/layout.tsx b/apps/website/src/app/layout.tsx index 6ee6b22..a8242d7 100644 --- a/apps/website/src/app/layout.tsx +++ b/apps/website/src/app/layout.tsx @@ -6,6 +6,7 @@ import { ReactNode } from "react"; import { DraftModeBanner } from "../components/DraftModeBanner/DraftModeBanner"; import { Footer } from "../components/Footer/Footer"; import { Navigation } from "../components/Navigation/Navigation"; +import "../lib/env"; import { createGenerateMetadata, ogImage } from "../lib/metadata"; import { getMetadata } from "../lib/queries"; import "../styles/global.css"; diff --git a/apps/website/src/components/Carousel/Carousel.tsx b/apps/website/src/components/Carousel/Carousel.tsx index d0ab775..07d3dc7 100644 --- a/apps/website/src/components/Carousel/Carousel.tsx +++ b/apps/website/src/components/Carousel/Carousel.tsx @@ -122,7 +122,7 @@ export const Carousel = ({ {} + } +} diff --git a/apps/website/src/lib/sanity.ts b/apps/website/src/lib/sanity.ts index d7c9e16..1556813 100644 --- a/apps/website/src/lib/sanity.ts +++ b/apps/website/src/lib/sanity.ts @@ -3,8 +3,8 @@ import "server-only"; import { draftMode } from "next/headers"; import { z } from "zod"; -const SANITY_PROJECT_ID = z.string().parse(process.env.SANITY_PROJECT_ID); -const SANITY_AUTH_TOKEN = z.string().parse(process.env.SANITY_AUTH_TOKEN); +const { SANITY_PROJECT_ID, SANITY_AUTH_TOKEN } = process.env; + const DATASET = "production"; const API_Version = "2023-10-12"; diff --git a/apps/website/src/lib/tracking.ts b/apps/website/src/lib/tracking.ts index 3d06cd7..ee95e21 100644 --- a/apps/website/src/lib/tracking.ts +++ b/apps/website/src/lib/tracking.ts @@ -1,3 +1,5 @@ +const { NEXT_PUBLIC_VERCEL_ENV, NODE_ENV } = process.env; + interface TrackingEvents { "Carousel item selected": { item: any; @@ -25,10 +27,10 @@ export const track = ( : [event: TEventKey, data: TrackingEvents[TEventKey]] ) => { const [event, data] = args; - if (process.env.NEXT_PUBLIC_VERCEL_ENV === "production") { + if (NEXT_PUBLIC_VERCEL_ENV === "production") { splitbee.track(event, data); } - if (process.env.NODE_ENV === "development") { + if (NODE_ENV === "development") { console.info("Tracking event:", { event, data,