mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add d1 in builder
This commit is contained in:
@@ -533,6 +533,71 @@ const analyzeStackCompatibility = (stack: StackState): CompatibilityResult => {
|
||||
"Database set to 'PostgreSQL' (required by Supabase setup)",
|
||||
});
|
||||
}
|
||||
} else if (nextStack.dbSetup === "d1") {
|
||||
if (nextStack.database !== "sqlite") {
|
||||
notes.dbSetup.notes.push(
|
||||
"Cloudflare D1 requires SQLite. It will be selected.",
|
||||
);
|
||||
notes.database.notes.push(
|
||||
"Cloudflare D1 DB setup requires SQLite. It will be selected.",
|
||||
);
|
||||
notes.dbSetup.hasIssue = true;
|
||||
notes.database.hasIssue = true;
|
||||
nextStack.database = "sqlite";
|
||||
changed = true;
|
||||
changes.push({
|
||||
category: "dbSetup",
|
||||
message: "Database set to 'SQLite' (required by Cloudflare D1)",
|
||||
});
|
||||
}
|
||||
if (nextStack.runtime !== "workers") {
|
||||
notes.dbSetup.notes.push(
|
||||
"Cloudflare D1 requires Cloudflare Workers runtime. It will be selected.",
|
||||
);
|
||||
notes.runtime.notes.push(
|
||||
"Cloudflare D1 DB setup requires Cloudflare Workers runtime. It will be selected.",
|
||||
);
|
||||
notes.dbSetup.hasIssue = true;
|
||||
notes.runtime.hasIssue = true;
|
||||
nextStack.runtime = "workers";
|
||||
changed = true;
|
||||
changes.push({
|
||||
category: "dbSetup",
|
||||
message: "Runtime set to 'Cloudflare Workers' (required by D1)",
|
||||
});
|
||||
}
|
||||
if (nextStack.orm !== "drizzle") {
|
||||
notes.dbSetup.notes.push(
|
||||
"Cloudflare D1 requires Drizzle ORM. It will be selected.",
|
||||
);
|
||||
notes.orm.notes.push(
|
||||
"Cloudflare D1 DB setup requires Drizzle ORM. It will be selected.",
|
||||
);
|
||||
notes.dbSetup.hasIssue = true;
|
||||
notes.orm.hasIssue = true;
|
||||
nextStack.orm = "drizzle";
|
||||
changed = true;
|
||||
changes.push({
|
||||
category: "dbSetup",
|
||||
message: "ORM set to 'Drizzle' (required by Cloudflare D1)",
|
||||
});
|
||||
}
|
||||
if (nextStack.backend !== "hono") {
|
||||
notes.dbSetup.notes.push(
|
||||
"Cloudflare D1 requires Hono backend. It will be selected.",
|
||||
);
|
||||
notes.backend.notes.push(
|
||||
"Cloudflare D1 DB setup requires Hono backend. It will be selected.",
|
||||
);
|
||||
notes.dbSetup.hasIssue = true;
|
||||
notes.backend.hasIssue = true;
|
||||
nextStack.backend = "hono";
|
||||
changed = true;
|
||||
changes.push({
|
||||
category: "dbSetup",
|
||||
message: "Backend set to 'Hono' (required by Cloudflare D1)",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (nextStack.runtime === "workers") {
|
||||
|
||||
@@ -276,6 +276,13 @@ export const TECH_OPTIONS = {
|
||||
icon: "/icon/turso.svg",
|
||||
color: "from-pink-400 to-pink-600",
|
||||
},
|
||||
{
|
||||
id: "d1",
|
||||
name: "Cloudflare D1",
|
||||
description: "Serverless SQLite database on Cloudflare Workers",
|
||||
icon: "/icon/workers.svg",
|
||||
color: "from-orange-400 to-orange-600",
|
||||
},
|
||||
{
|
||||
id: "neon",
|
||||
name: "Neon Postgres",
|
||||
|
||||
Reference in New Issue
Block a user