feat(cli): prisma + workers, prisma + turso, planetscale (postgres/mysql) support (#567)

This commit is contained in:
Aman Varshney
2025-09-08 12:15:26 +05:30
committed by GitHub
parent 33344d91be
commit cd5d0f0aeb
66 changed files with 1486 additions and 729 deletions

View File

@@ -5,7 +5,7 @@ import { exitCancelled } from "../utils/errors";
export async function getDBSetupChoice(
databaseType: string,
dbSetup: DatabaseSetup | undefined,
orm?: ORM,
_orm?: ORM,
backend?: Backend,
runtime?: Runtime,
): Promise<DatabaseSetup> {
@@ -19,10 +19,6 @@ export async function getDBSetupChoice(
return "none";
}
if (databaseType === "sqlite" && orm === "prisma") {
return "none";
}
let options: Array<{ value: DatabaseSetup; label: string; hint: string }> =
[];
@@ -51,6 +47,11 @@ export async function getDBSetupChoice(
label: "Neon Postgres",
hint: "Serverless Postgres with branching capability",
},
{
value: "planetscale" as const,
label: "PlanetScale",
hint: "Serverless MySQL platform with branching (Postgres compatible)",
},
{
value: "supabase" as const,
label: "Supabase",
@@ -70,6 +71,11 @@ export async function getDBSetupChoice(
];
} else if (databaseType === "mysql") {
options = [
{
value: "planetscale" as const,
label: "PlanetScale",
hint: "Serverless MySQL platform with branching",
},
{
value: "docker" as const,
label: "Docker",

View File

@@ -35,10 +35,6 @@ export async function getORMChoice(
if (!hasDatabase) return "none";
if (orm !== undefined) return orm;
if (runtime === "workers") {
return "drizzle";
}
const options = [
...(database === "mongodb"
? [ormOptions.prisma, ormOptions.mongoose]
@@ -48,7 +44,12 @@ export async function getORMChoice(
const response = await select<ORM>({
message: "Select ORM",
options,
initialValue: database === "mongodb" ? "prisma" : DEFAULT_CONFIG.orm,
initialValue:
database === "mongodb"
? "prisma"
: runtime === "workers"
? "drizzle"
: DEFAULT_CONFIG.orm,
});
if (isCancel(response)) return exitCancelled("Operation cancelled");

View File

@@ -47,10 +47,7 @@ export async function getDeploymentChoice(
return "none";
}
const hasIncompatibleFrontend = frontend.some((f) => f === "next");
const availableDeployments = hasIncompatibleFrontend
? ["wrangler", "none"]
: ["wrangler", "alchemy", "none"];
const availableDeployments = ["wrangler", "alchemy", "none"];
const options: DeploymentOption[] = availableDeployments.map((deploy) => {
const { label, hint } = getDeploymentDisplay(deploy as WebDeploy);
@@ -64,9 +61,7 @@ export async function getDeploymentChoice(
const response = await select<WebDeploy>({
message: "Select web deployment",
options,
initialValue: hasIncompatibleFrontend
? "wrangler"
: DEFAULT_CONFIG.webDeploy,
initialValue: DEFAULT_CONFIG.webDeploy,
});
if (isCancel(response)) return exitCancelled("Operation cancelled");
@@ -82,8 +77,6 @@ export async function getDeploymentToAdd(
return "none";
}
const hasIncompatibleFrontend = frontend.some((f) => f === "next");
const options: DeploymentOption[] = [];
if (existingDeployment !== "wrangler") {
@@ -95,7 +88,7 @@ export async function getDeploymentToAdd(
});
}
if (existingDeployment !== "alchemy" && !hasIncompatibleFrontend) {
if (existingDeployment !== "alchemy") {
const { label, hint } = getDeploymentDisplay("alchemy");
options.push({
value: "alchemy",
@@ -123,9 +116,7 @@ export async function getDeploymentToAdd(
const response = await select<WebDeploy>({
message: "Select web deployment",
options,
initialValue: hasIncompatibleFrontend
? "wrangler"
: DEFAULT_CONFIG.webDeploy,
initialValue: DEFAULT_CONFIG.webDeploy,
});
if (isCancel(response)) return exitCancelled("Operation cancelled");