@reliverse/rse
Version:
@reliverse/rse is your all-in-one companion for bootstrapping and improving any kind of projects (especially web apps built with frameworks like Next.js) — whether you're kicking off something new or upgrading an existing app. It is also a little AI-power
45 lines (44 loc) • 1.18 kB
JavaScript
import { re } from "@reliverse/relico";
import { cancel, isCancel, multiselect } from "@reliverse/rempts";
import { DEFAULT_CONFIG } from "../constants.js";
export async function getExamplesChoice(examples, database, frontends, backend, api) {
if (api === "none") {
return [];
}
if (examples !== void 0) return examples;
if (backend === "convex") {
return ["todo"];
}
if (backend === "none") {
return [];
}
if (database === "none") return [];
const noFrontendSelected = !frontends || frontends.length === 0;
if (noFrontendSelected) return [];
let response = [];
const options = [
{
value: "todo",
label: "Todo App",
hint: "A simple CRUD example app"
}
];
if (backend !== "elysia" && !frontends?.includes("solid")) {
options.push({
value: "ai",
label: "AI Chat",
hint: "A simple AI chat interface using AI SDK"
});
}
response = await multiselect({
message: "Include examples",
options,
required: false,
initialValues: DEFAULT_CONFIG.examples
});
if (isCancel(response)) {
cancel(re.red("Operation cancelled"));
process.exit(0);
}
return response;
}