mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
cli create: updated templates, reworked examples to be standalone
This commit is contained in:
@@ -7,9 +7,9 @@ export type TPackageJson = Partial<{
|
||||
main: string;
|
||||
version: string;
|
||||
scripts: Record<string, string>;
|
||||
dependencies: Record<string, string>;
|
||||
devDependencies: Record<string, string>;
|
||||
optionalDependencies: Record<string, string>;
|
||||
dependencies: Record<string, string | undefined>;
|
||||
devDependencies: Record<string, string | undefined>;
|
||||
optionalDependencies: Record<string, string | undefined>;
|
||||
[key: string]: any;
|
||||
}>;
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ async function createLibsql(ctx: TemplateSetupCtx) {
|
||||
...pkg,
|
||||
scripts: {
|
||||
...pkg.scripts,
|
||||
db: "turso db",
|
||||
db: "turso dev",
|
||||
dev: "npm run db && wrangler dev"
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { cloudflare } from "./cloudflare";
|
||||
import { nextjs } from "./nextjs";
|
||||
import { remix } from "./remix";
|
||||
|
||||
export type TemplateSetupCtx = {
|
||||
template: Template;
|
||||
@@ -32,6 +34,9 @@ export type Template = {
|
||||
};
|
||||
|
||||
export const templates: Template[] = [
|
||||
cloudflare,
|
||||
nextjs,
|
||||
remix,
|
||||
{
|
||||
key: "node",
|
||||
title: "Node.js Basic",
|
||||
@@ -48,27 +53,6 @@ export const templates: Template[] = [
|
||||
path: "gh:bknd-io/bknd/examples/bun",
|
||||
ref: true
|
||||
},
|
||||
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",
|
||||
|
||||
29
app/src/cli/commands/create/templates/nextjs.ts
Normal file
29
app/src/cli/commands/create/templates/nextjs.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { overridePackageJson } from "cli/commands/create/npm";
|
||||
import type { Template } from ".";
|
||||
|
||||
// @todo: add `concurrently`?
|
||||
export const nextjs = {
|
||||
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,
|
||||
preinstall: async (ctx) => {
|
||||
// locally it's required to overwrite react, here it is not
|
||||
await overridePackageJson(
|
||||
(pkg) => ({
|
||||
...pkg,
|
||||
dependencies: {
|
||||
...pkg.dependencies,
|
||||
react: undefined,
|
||||
"react-dom": undefined
|
||||
}
|
||||
}),
|
||||
{ dir: ctx.dir }
|
||||
);
|
||||
}
|
||||
} as const satisfies Template;
|
||||
25
app/src/cli/commands/create/templates/remix.ts
Normal file
25
app/src/cli/commands/create/templates/remix.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { overridePackageJson } from "cli/commands/create/npm";
|
||||
import type { Template } from ".";
|
||||
|
||||
export const remix = {
|
||||
key: "remix",
|
||||
title: "Remix Basic",
|
||||
integration: "remix",
|
||||
description: "A basic bknd Remix starter",
|
||||
path: "gh:bknd-io/bknd/examples/remix",
|
||||
ref: true,
|
||||
preinstall: async (ctx) => {
|
||||
// locally it's required to overwrite react
|
||||
await overridePackageJson(
|
||||
(pkg) => ({
|
||||
...pkg,
|
||||
dependencies: {
|
||||
...pkg.dependencies,
|
||||
react: "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
}
|
||||
}),
|
||||
{ dir: ctx.dir }
|
||||
);
|
||||
}
|
||||
} as const satisfies Template;
|
||||
Reference in New Issue
Block a user