finalize initial starters

This commit is contained in:
dswbx
2025-02-14 13:55:46 +01:00
parent 7d3c76d7c1
commit 3b487ade2a
8 changed files with 180 additions and 64 deletions

View File

@@ -3,10 +3,12 @@ import { cloudflare } from "./cloudflare";
export type TemplateSetupCtx = {
template: Template;
dir: string;
name: string;
};
export type Integration = "node" | "bun" | "cloudflare" | "nextjs" | "remix" | "astro" | "custom";
type TemplateScripts = "install" | "dev" | "build" | "start";
export type Template = {
/**
* unique key for the template
@@ -23,12 +25,13 @@ export type Template = {
* adds a ref "#{ref}" to the path. If "true", adds the current version of bknd
*/
ref?: true | string;
scripts?: Partial<Record<TemplateScripts, string>>;
preinstall?: (ctx: TemplateSetupCtx) => Promise<void>;
postinstall?: (ctx: TemplateSetupCtx) => Promise<void>;
setup?: (ctx: TemplateSetupCtx) => Promise<void>;
};
export const templates = [
export const templates: Template[] = [
{
key: "node",
title: "Node.js Basic",
@@ -45,5 +48,33 @@ export const templates = [
path: "gh:bknd-io/bknd/examples/bun",
ref: true
},
cloudflare
] as const satisfies Template[];
cloudflare,
{
key: "remix",
title: "Remix Basic",
integration: "remix",
description: "A basic bknd Remix starter",
path: "gh:bknd-io/bknd/examples/remix",
ref: true
},
{
// @todo: add `concurrently`?
key: "nextjs",
title: "Next.js Basic",
integration: "nextjs",
description: "A basic bknd Next.js starter",
path: "gh:bknd-io/bknd/examples/nextjs",
scripts: {
install: "npm install --force"
},
ref: true
},
{
key: "astro",
title: "Astro Basic",
integration: "astro",
description: "A basic bknd Astro starter",
path: "gh:bknd-io/bknd/examples/astro",
ref: true
}
];