mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add automatic prisma postgres setup
fix tanstack auth template
This commit is contained in:
@@ -21,6 +21,7 @@ import { getGitChoice } from "./git";
|
||||
import { getNoInstallChoice } from "./install";
|
||||
import { getORMChoice } from "./orm";
|
||||
import { getPackageManagerChoice } from "./package-manager";
|
||||
import { getPrismaSetupChoice } from "./prisma-postgres";
|
||||
import { getProjectName } from "./project-name";
|
||||
import { getRuntimeChoice } from "./runtime";
|
||||
import { getTursoSetupChoice } from "./turso";
|
||||
@@ -36,6 +37,7 @@ type PromptGroupResults = {
|
||||
packageManager: ProjectPackageManager;
|
||||
noInstall: boolean;
|
||||
turso: boolean;
|
||||
prismaPostgres: boolean;
|
||||
backend: ProjectBackend;
|
||||
runtime: ProjectRuntime;
|
||||
frontend: ProjectFrontend[];
|
||||
@@ -65,6 +67,10 @@ export async function gatherConfig(
|
||||
results.database === "sqlite" && results.orm !== "prisma"
|
||||
? getTursoSetupChoice(flags.turso)
|
||||
: Promise.resolve(false),
|
||||
prismaPostgres: ({ results }) =>
|
||||
results.database === "postgres" && results.orm === "prisma"
|
||||
? getPrismaSetupChoice(flags.prismaPostgres)
|
||||
: Promise.resolve(false),
|
||||
addons: ({ results }) => getAddonsChoice(flags.addons, results.frontend),
|
||||
examples: ({ results }) =>
|
||||
getExamplesChoice(
|
||||
@@ -97,6 +103,7 @@ export async function gatherConfig(
|
||||
packageManager: result.packageManager,
|
||||
noInstall: result.noInstall,
|
||||
turso: result.turso,
|
||||
prismaPostgres: result.prismaPostgres,
|
||||
backend: result.backend,
|
||||
runtime: result.runtime,
|
||||
};
|
||||
|
||||
21
apps/cli/src/prompts/prisma-postgres.ts
Normal file
21
apps/cli/src/prompts/prisma-postgres.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { cancel, confirm, isCancel } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
|
||||
export async function getPrismaSetupChoice(
|
||||
prismaSetup?: boolean,
|
||||
): Promise<boolean> {
|
||||
if (prismaSetup !== undefined) return prismaSetup;
|
||||
|
||||
const response = await confirm({
|
||||
message: "Set up Prisma Postgres database?",
|
||||
initialValue: DEFAULT_CONFIG.prismaPostgres,
|
||||
});
|
||||
|
||||
if (isCancel(response)) {
|
||||
cancel(pc.red("Operation cancelled"));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
Reference in New Issue
Block a user