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,23 @@
import { cancel, confirm, isCancel } from "@clack/prompts";
import pc from "picocolors";
import { DEFAULT_CONFIG } from "../constants";
export async function getAuthChoice(
auth: boolean | undefined,
hasDatabase: boolean,
): Promise<boolean> {
if (!hasDatabase) return false;
if (auth !== undefined) return auth;
const response = await confirm({
message: "Would you like to add authentication with Better-Auth?",
initialValue: DEFAULT_CONFIG.auth,
});
if (isCancel(response)) {
cancel(pc.red("Operation cancelled"));
process.exit(0);
}
return response;
}