Support Next.js template & template hub (#241)

This commit is contained in:
Will Chen
2025-05-27 00:16:30 -07:00
committed by GitHub
parent 8cfd476ea9
commit a915d892f7
8 changed files with 361 additions and 12 deletions

38
src/shared/templates.ts Normal file
View File

@@ -0,0 +1,38 @@
export interface Template {
id: string;
title: string;
description: string;
imageUrl: string;
githubUrl?: string;
isOfficial: boolean;
}
export const DEFAULT_TEMPLATE_ID = "react";
export const templatesData: Template[] = [
{
id: "react",
title: "React.js Template",
description: "Uses React.js, Vite, Shadcn, Tailwind and TypeScript.",
imageUrl:
"https://github.com/user-attachments/assets/5b700eab-b28c-498e-96de-8649b14c16d9",
isOfficial: true,
},
{
id: "next",
title: "Next.js Template",
description: "Uses Next.js, React.js, Shadcn, Tailwind and TypeScript.",
imageUrl:
"https://github.com/user-attachments/assets/96258e4f-abce-4910-a62a-a9dff77965f2",
githubUrl: "https://github.com/dyad-sh/nextjs-template",
isOfficial: true,
},
];
export function getTemplateOrThrow(templateId: string): Template {
const template = templatesData.find((template) => template.id === templateId);
if (!template) {
throw new Error(`Template ${templateId} not found`);
}
return template;
}