@reliverse/rse-sdk
Version:
@reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).
64 lines (63 loc) • 2.71 kB
JavaScript
import { re } from "@reliverse/relico";
export function displayConfig(config) {
const configDisplay = [];
if (config.projectName) {
configDisplay.push(`${re.blue("Project Name:")} ${config.projectName}`);
}
if (config.frontend !== void 0) {
const frontend = Array.isArray(config.frontend) ? config.frontend : [config.frontend];
const frontendText = frontend.length > 0 && frontend[0] !== void 0 ? frontend.join(", ") : "none";
configDisplay.push(`${re.blue("Frontend:")} ${frontendText}`);
}
if (config.backend !== void 0) {
configDisplay.push(`${re.blue("Backend:")} ${String(config.backend)}`);
}
if (config.runtime !== void 0) {
configDisplay.push(`${re.blue("Runtime:")} ${String(config.runtime)}`);
}
if (config.api !== void 0) {
configDisplay.push(`${re.blue("API:")} ${String(config.api)}`);
}
if (config.database !== void 0) {
configDisplay.push(`${re.blue("Database:")} ${String(config.database)}`);
}
if (config.orm !== void 0) {
configDisplay.push(`${re.blue("ORM:")} ${String(config.orm)}`);
}
if (config.auth !== void 0) {
const authText = typeof config.auth === "boolean" ? config.auth ? "Yes" : "No" : String(config.auth);
configDisplay.push(`${re.blue("Authentication:")} ${authText}`);
}
if (config.addons !== void 0) {
const addons = Array.isArray(config.addons) ? config.addons : [config.addons];
const addonsText = addons.length > 0 && addons[0] !== void 0 ? addons.join(", ") : "none";
configDisplay.push(`${re.blue("Addons:")} ${addonsText}`);
}
if (config.examples !== void 0) {
const examples = Array.isArray(config.examples) ? config.examples : [config.examples];
const examplesText = examples.length > 0 && examples[0] !== void 0 ? examples.join(", ") : "none";
configDisplay.push(`${re.blue("Examples:")} ${examplesText}`);
}
if (config.git !== void 0) {
const gitText = typeof config.git === "boolean" ? config.git ? "Yes" : "No" : String(config.git);
configDisplay.push(`${re.blue("Git Init:")} ${gitText}`);
}
if (config.packageManager !== void 0) {
configDisplay.push(
`${re.blue("Package Manager:")} ${String(config.packageManager)}`
);
}
if (config.install !== void 0) {
const installText = typeof config.install === "boolean" ? config.install ? "Yes" : "No" : String(config.install);
configDisplay.push(`${re.blue("Install Dependencies:")} ${installText}`);
}
if (config.dbSetup !== void 0) {
configDisplay.push(
`${re.blue("Database Setup:")} ${String(config.dbSetup)}`
);
}
if (configDisplay.length === 0) {
return re.yellow("No configuration selected.");
}
return configDisplay.join("\n");
}