organize code

This commit is contained in:
Aman Varshney
2025-02-20 19:14:28 +05:30
parent 9032a598d0
commit f804a9efda
16 changed files with 451 additions and 282 deletions

View File

@@ -0,0 +1,30 @@
import { cancel, isCancel, select } from "@clack/prompts";
import pc from "picocolors";
import type { ProjectORM } from "../types";
export async function getORMChoice(
orm: ProjectORM | undefined,
hasDatabase: boolean,
): Promise<ProjectORM> {
if (!hasDatabase) return "none";
if (orm !== undefined) return orm;
const response = await select<ProjectORM>({
message: "Which ORM would you like to use?",
options: [
{
value: "drizzle",
label: "Drizzle",
hint: "Type-safe, lightweight ORM (recommended)",
},
],
initialValue: "drizzle",
});
if (isCancel(response)) {
cancel(pc.red("Operation cancelled"));
process.exit(0);
}
return response;
}