mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
Add backend framework selection between hono, elysiajs
This commit is contained in:
@@ -7,32 +7,55 @@ export function displayConfig(config: Partial<ProjectConfig>) {
|
||||
if (config.projectName) {
|
||||
configDisplay.push(`${pc.blue("Project Name:")} ${config.projectName}`);
|
||||
}
|
||||
if (config.database) {
|
||||
|
||||
if (config.backendFramework !== undefined) {
|
||||
configDisplay.push(
|
||||
`${pc.blue("Backend Framework:")} ${config.backendFramework}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (config.runtime !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Runtime:")} ${config.runtime}`);
|
||||
}
|
||||
|
||||
if (config.database !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Database:")} ${config.database}`);
|
||||
}
|
||||
if (config.orm) {
|
||||
|
||||
if (config.orm !== undefined) {
|
||||
configDisplay.push(`${pc.blue("ORM:")} ${config.orm}`);
|
||||
}
|
||||
|
||||
if (config.auth !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Authentication:")} ${config.auth}`);
|
||||
}
|
||||
if (config.runtime) {
|
||||
configDisplay.push(`${pc.blue("Runtime:")} ${config.runtime}`);
|
||||
|
||||
if (config.addons !== undefined) {
|
||||
const addonsText =
|
||||
config.addons.length > 0 ? config.addons.join(", ") : "none";
|
||||
configDisplay.push(`${pc.blue("Addons:")} ${addonsText}`);
|
||||
}
|
||||
if (config.addons?.length) {
|
||||
configDisplay.push(`${pc.blue("Addons:")} ${config.addons.join(", ")}`);
|
||||
|
||||
if (config.examples !== undefined) {
|
||||
const examplesText =
|
||||
config.examples.length > 0 ? config.examples.join(", ") : "none";
|
||||
configDisplay.push(`${pc.blue("Examples:")} ${examplesText}`);
|
||||
}
|
||||
|
||||
if (config.git !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Git Init:")} ${config.git}`);
|
||||
}
|
||||
if (config.packageManager) {
|
||||
|
||||
if (config.packageManager !== undefined) {
|
||||
configDisplay.push(
|
||||
`${pc.blue("Package Manager:")} ${config.packageManager}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (config.noInstall !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Skip Install:")} ${config.noInstall}`);
|
||||
}
|
||||
|
||||
if (config.turso !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Turso Setup:")} ${config.turso}`);
|
||||
}
|
||||
|
||||
@@ -5,42 +5,36 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
|
||||
if (config.database === "none") {
|
||||
flags.push("--no-database");
|
||||
} else if (config.database === "sqlite") {
|
||||
flags.push("--sqlite");
|
||||
} else if (config.database === "postgres") {
|
||||
flags.push("--postgres");
|
||||
}
|
||||
} else {
|
||||
flags.push(`--${config.database}`);
|
||||
|
||||
if (config.database !== "none") {
|
||||
if (config.orm === "drizzle") {
|
||||
flags.push("--drizzle");
|
||||
} else if (config.orm === "prisma") {
|
||||
flags.push("--prisma");
|
||||
if (config.orm) {
|
||||
flags.push(`--${config.orm}`);
|
||||
}
|
||||
|
||||
if (config.database === "sqlite") {
|
||||
flags.push(config.turso ? "--turso" : "--no-turso");
|
||||
}
|
||||
}
|
||||
|
||||
if (config.auth) {
|
||||
flags.push("--auth");
|
||||
} else {
|
||||
flags.push("--no-auth");
|
||||
}
|
||||
flags.push(config.auth ? "--auth" : "--no-auth");
|
||||
|
||||
if (config.git) {
|
||||
flags.push("--git");
|
||||
} else {
|
||||
flags.push("--no-git");
|
||||
}
|
||||
flags.push(config.git ? "--git" : "--no-git");
|
||||
|
||||
if (config.noInstall) {
|
||||
flags.push("--no-install");
|
||||
} else {
|
||||
flags.push("--install");
|
||||
}
|
||||
flags.push(config.noInstall ? "--no-install" : "--install");
|
||||
|
||||
if (config.packageManager) {
|
||||
flags.push(`--${config.packageManager}`);
|
||||
}
|
||||
|
||||
if (config.backendFramework) {
|
||||
flags.push(`--${config.backendFramework}`);
|
||||
}
|
||||
|
||||
if (config.runtime) {
|
||||
flags.push(`--runtime ${config.runtime}`);
|
||||
}
|
||||
|
||||
if (config.addons.length > 0) {
|
||||
for (const addon of config.addons) {
|
||||
flags.push(`--${addon}`);
|
||||
@@ -55,21 +49,8 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
flags.push("--no-examples");
|
||||
}
|
||||
|
||||
if (config.database === "sqlite") {
|
||||
if (config.turso) {
|
||||
flags.push("--turso");
|
||||
} else {
|
||||
flags.push("--no-turso");
|
||||
}
|
||||
}
|
||||
|
||||
if (config.runtime) {
|
||||
flags.push(`--runtime ${config.runtime}`);
|
||||
}
|
||||
|
||||
const baseCommand = "npx create-better-t-stack";
|
||||
const projectName = config.projectName ? ` ${config.projectName}` : "";
|
||||
const flagString = flags.length > 0 ? ` ${flags.join(" ")}` : "";
|
||||
|
||||
return `${baseCommand}${projectName}${flagString}`;
|
||||
return `${baseCommand}${projectName} ${flags.join(" ")}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user