mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add orpc
This commit is contained in:
@@ -2,66 +2,109 @@ import pc from "picocolors";
|
||||
import type { ProjectConfig } from "../types";
|
||||
|
||||
export function displayConfig(config: Partial<ProjectConfig>) {
|
||||
const configDisplay = [];
|
||||
const configDisplay: string[] = [];
|
||||
|
||||
if (config.projectName) {
|
||||
configDisplay.push(`${pc.blue("Project Name:")} ${config.projectName}`);
|
||||
}
|
||||
|
||||
if (config.frontend !== undefined) {
|
||||
const frontend = Array.isArray(config.frontend)
|
||||
? config.frontend
|
||||
: [config.frontend];
|
||||
const frontendText =
|
||||
config.frontend.length > 0 ? config.frontend.join(", ") : "none";
|
||||
frontend.length > 0 && frontend[0] !== undefined && frontend[0] !== ""
|
||||
? frontend.join(", ")
|
||||
: "none";
|
||||
configDisplay.push(`${pc.blue("Frontend:")} ${frontendText}`);
|
||||
}
|
||||
|
||||
if (config.backend !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Backend Framework:")} ${config.backend}`);
|
||||
configDisplay.push(
|
||||
`${pc.blue("Backend Framework:")} ${String(config.backend)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (config.runtime !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Runtime:")} ${config.runtime}`);
|
||||
configDisplay.push(`${pc.blue("Runtime:")} ${String(config.runtime)}`);
|
||||
}
|
||||
|
||||
if (config.api !== undefined) {
|
||||
configDisplay.push(`${pc.blue("API:")} ${String(config.api)}`);
|
||||
}
|
||||
|
||||
if (config.database !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Database:")} ${config.database}`);
|
||||
configDisplay.push(`${pc.blue("Database:")} ${String(config.database)}`);
|
||||
}
|
||||
|
||||
if (config.orm !== undefined) {
|
||||
configDisplay.push(`${pc.blue("ORM:")} ${config.orm}`);
|
||||
configDisplay.push(`${pc.blue("ORM:")} ${String(config.orm)}`);
|
||||
}
|
||||
|
||||
if (config.auth !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Authentication:")} ${config.auth}`);
|
||||
const authText =
|
||||
typeof config.auth === "boolean"
|
||||
? config.auth
|
||||
? "Yes"
|
||||
: "No"
|
||||
: String(config.auth);
|
||||
configDisplay.push(`${pc.blue("Authentication:")} ${authText}`);
|
||||
}
|
||||
|
||||
if (config.addons !== undefined) {
|
||||
const addons = Array.isArray(config.addons)
|
||||
? config.addons
|
||||
: [config.addons];
|
||||
const addonsText =
|
||||
config.addons.length > 0 ? config.addons.join(", ") : "none";
|
||||
addons.length > 0 && addons[0] !== undefined ? addons.join(", ") : "none";
|
||||
configDisplay.push(`${pc.blue("Addons:")} ${addonsText}`);
|
||||
}
|
||||
|
||||
if (config.examples !== undefined) {
|
||||
const examples = Array.isArray(config.examples)
|
||||
? config.examples
|
||||
: [config.examples];
|
||||
const examplesText =
|
||||
config.examples.length > 0 ? config.examples.join(", ") : "none";
|
||||
examples.length > 0 && examples[0] !== undefined
|
||||
? examples.join(", ")
|
||||
: "none";
|
||||
configDisplay.push(`${pc.blue("Examples:")} ${examplesText}`);
|
||||
}
|
||||
|
||||
if (config.git !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Git Init:")} ${config.git}`);
|
||||
const gitText =
|
||||
typeof config.git === "boolean"
|
||||
? config.git
|
||||
? "Yes"
|
||||
: "No"
|
||||
: String(config.git);
|
||||
configDisplay.push(`${pc.blue("Git Init:")} ${gitText}`);
|
||||
}
|
||||
|
||||
if (config.packageManager !== undefined) {
|
||||
configDisplay.push(
|
||||
`${pc.blue("Package Manager:")} ${config.packageManager}`,
|
||||
`${pc.blue("Package Manager:")} ${String(config.packageManager)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (config.noInstall !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Skip Install:")} ${config.noInstall}`);
|
||||
if (config.install !== undefined) {
|
||||
const installText =
|
||||
typeof config.install === "boolean"
|
||||
? config.install
|
||||
? "Yes"
|
||||
: "No"
|
||||
: String(config.install);
|
||||
configDisplay.push(`${pc.blue("Install Dependencies:")} ${installText}`);
|
||||
}
|
||||
|
||||
if (config.dbSetup !== undefined) {
|
||||
configDisplay.push(`${pc.blue("Database Setup:")} ${config.dbSetup}`);
|
||||
configDisplay.push(
|
||||
`${pc.blue("Database Setup:")} ${String(config.dbSetup)}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (configDisplay.length === 0) {
|
||||
return pc.yellow("No configuration selected.");
|
||||
}
|
||||
|
||||
return configDisplay.join("\n");
|
||||
|
||||
Reference in New Issue
Block a user