From f8d65c4ab9b4715700bbed553e08fac39988a2bb Mon Sep 17 00:00:00 2001 From: zbeyens Date: Tue, 26 Nov 2024 09:40:28 +0100 Subject: [PATCH] perf --- apps/www/src/app/api/registry/[name]/route.ts | 11 ++++++++++- config/eslint/bases/unicorn.cjs | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/www/src/app/api/registry/[name]/route.ts b/apps/www/src/app/api/registry/[name]/route.ts index f634d7c91b..addf18c005 100644 --- a/apps/www/src/app/api/registry/[name]/route.ts +++ b/apps/www/src/app/api/registry/[name]/route.ts @@ -3,14 +3,23 @@ import { z } from 'zod'; import { highlightFiles } from '@/lib/highlight-code'; import { getRegistryItem } from '@/lib/registry'; +import { registry } from '@/registry/registry'; + +export const dynamic = 'force-static'; const ParamsSchema = z.object({ name: z.string().min(1, 'Name parameter is required'), }); +export function generateStaticParams() { + return registry.map(({ name }) => ({ + name, + })); +} + export async function GET(_: Request, { params }: any) { try { - const { name } = ParamsSchema.parse({ name: params.name }); + const { name } = ParamsSchema.parse({ name: (await params).name }); const item = await getRegistryItem(name); diff --git a/config/eslint/bases/unicorn.cjs b/config/eslint/bases/unicorn.cjs index 33b82173e1..08a3172d8a 100644 --- a/config/eslint/bases/unicorn.cjs +++ b/config/eslint/bases/unicorn.cjs @@ -27,6 +27,7 @@ module.exports = { 'unicorn/no-array-callback-reference': 'off', 'unicorn/no-array-for-each': 'off', 'unicorn/no-array-reduce': 'off', + 'unicorn/no-await-expression-member': 'off', 'unicorn/no-document-cookie': 'off', 'unicorn/no-for-loop': 'off', 'unicorn/no-null': 'off',