add deno to the cli starters

This commit is contained in:
dswbx
2025-10-25 10:18:43 +02:00
parent 1fc6e810ae
commit b787837dd2
7 changed files with 48 additions and 16 deletions

View File

@@ -20,6 +20,7 @@ const config = {
node: "Node.js",
bun: "Bun",
cloudflare: "Cloudflare",
deno: "Deno",
aws: "AWS Lambda",
},
framework: {
@@ -269,7 +270,7 @@ async function action(options: {
);
$p.log.success(`Updated package name to ${color.cyan(ctx.name)}`);
{
if (template.installDeps !== false) {
const install =
options.yes ??
(await $p.confirm({

View File

@@ -0,0 +1,21 @@
import { overrideJson } from "cli/commands/create/npm";
import type { Template } from "cli/commands/create/templates";
import { getVersion } from "cli/utils/sys";
export const deno = {
key: "deno",
title: "Deno Basic",
integration: "deno",
description: "A basic bknd Deno server with static assets",
path: "gh:bknd-io/bknd/examples/deno",
installDeps: false,
ref: true,
setup: async (ctx) => {
const version = await getVersion();
await overrideJson(
"deno.json",
(json) => ({ ...json, links: undefined, imports: { bknd: `npm:bknd@${version}` } }),
{ dir: ctx.dir },
);
},
} satisfies Template;

View File

@@ -1,3 +1,4 @@
import { deno } from "cli/commands/create/templates/deno";
import { cloudflare } from "./cloudflare";
export type TemplateSetupCtx = {
@@ -15,6 +16,7 @@ export type Integration =
| "react-router"
| "astro"
| "aws"
| "deno"
| "custom";
type TemplateScripts = "install" | "dev" | "build" | "start";
@@ -34,6 +36,11 @@ export type Template = {
* adds a ref "#{ref}" to the path. If "true", adds the current version of bknd
*/
ref?: true | string;
/**
* control whether to install dependencies automatically
* e.g. on deno, this is not needed
*/
installDeps?: boolean;
scripts?: Partial<Record<TemplateScripts, string>>;
preinstall?: (ctx: TemplateSetupCtx) => Promise<void>;
postinstall?: (ctx: TemplateSetupCtx) => Promise<void>;
@@ -90,4 +97,5 @@ export const templates: Template[] = [
path: "gh:bknd-io/bknd/examples/aws-lambda",
ref: true,
},
deno,
];