Skip to content
Merged
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
2 changes: 1 addition & 1 deletion app/api/generate-topic/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getOpenAIClient } from "@/lib/openai";
import OpenAI from "openai";
import { NextResponse } from "next/server";
import OpenAI from "openai";

export async function POST() {
try {
Expand Down
4 changes: 2 additions & 2 deletions app/api/score-idea/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getOpenAIClient } from "@/lib/openai";
import { insertGameScore } from "@/lib/game-scores";
import OpenAI from "openai";
import { getOpenAIClient } from "@/lib/openai";
import { type NextRequest, NextResponse } from "next/server";
import OpenAI from "openai";

const SCORE_FUNCTION: OpenAI.Chat.Completions.ChatCompletionTool = {
type: "function",
Expand Down
2 changes: 1 addition & 1 deletion app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ErrorProps {
* Global error boundary — catches unhandled errors in the React tree.
* Must be a Client Component.
*/
export default function Error({ error, reset }: ErrorProps) {
export default function AppError({ error, reset }: ErrorProps) {
useEffect(() => {
console.error("[Error boundary]", error);
}, [error]);
Expand Down
4 changes: 1 addition & 3 deletions lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const required = ["NEXT_PUBLIC_SUPABASE_URL", "NEXT_PUBLIC_SUPABASE_ANON_KEY"] a
for (const key of required) {
if (!process.env[key]) {
throw new Error(
`Missing required environment variable: ${key}\n` +
`Copy .env.example to .env.local and fill in your Supabase credentials.\n` +
` cp .env.example .env.local`,
`Missing required environment variable: ${key}\nCopy .env.example to .env.local and fill in your Supabase credentials.\n cp .env.example .env.local`,
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/supabase/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createBrowserClient } from "@supabase/ssr";
*/
export function createClient() {
return createBrowserClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
process.env.NEXT_PUBLIC_SUPABASE_URL ?? "",
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? "",
);
}
4 changes: 2 additions & 2 deletions lib/supabase/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export async function updateSession(request: NextRequest) {
let supabaseResponse = NextResponse.next({ request });

const supabase = createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
process.env.NEXT_PUBLIC_SUPABASE_URL ?? "",
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? "",
{
cookies: {
getAll() {
Expand Down
4 changes: 2 additions & 2 deletions lib/supabase/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export async function createClient() {
const cookieStore = await cookies();

return createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
process.env.NEXT_PUBLIC_SUPABASE_URL ?? "",
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? "",
{
cookies: {
getAll() {
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("lib/env", () => {
});

it("throws when NEXT_PUBLIC_SUPABASE_URL is missing", async () => {
delete process.env.NEXT_PUBLIC_SUPABASE_URL;
process.env.NEXT_PUBLIC_SUPABASE_URL = undefined;
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY = "test-anon-key";

await expect(import("@/lib/env")).rejects.toThrow(
Expand All @@ -33,7 +33,7 @@ describe("lib/env", () => {

it("throws when NEXT_PUBLIC_SUPABASE_ANON_KEY is missing", async () => {
process.env.NEXT_PUBLIC_SUPABASE_URL = "https://test.supabase.co";
delete process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY = undefined;

await expect(import("@/lib/env")).rejects.toThrow(
"Missing required environment variable: NEXT_PUBLIC_SUPABASE_ANON_KEY",
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vitest/config";

Expand Down
Loading