UNPKG

@reliverse/rse-sdk

Version:

@reliverse/rse-sdk without cli. @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).

49 lines (48 loc) 1.31 kB
import { re } from "@reliverse/relico"; import { cancel, isCancel, select } from "@reliverse/rempts"; import { DEFAULT_CONFIG } from "../constants.js"; export async function getDatabaseChoice(database, backend, runtime) { if (backend === "convex" || backend === "none") { return "none"; } if (database !== void 0) return database; const databaseOptions = [ { value: "none", label: "None", hint: "No database setup" }, { value: "sqlite", label: "SQLite", hint: "lightweight, server-less, embedded relational database" }, { value: "postgres", label: "PostgreSQL", hint: "powerful, open source object-relational database system" }, { value: "mysql", label: "MySQL", hint: "popular open-source relational database system" } ]; if (runtime !== "workers") { databaseOptions.push({ value: "mongodb", label: "MongoDB", hint: "open-source NoSQL database that stores data in JSON-like documents called BSON" }); } const response = await select({ message: "Select database", options: databaseOptions, initialValue: DEFAULT_CONFIG.database }); if (isCancel(response)) { cancel(re.red("Operation cancelled")); process.exit(0); } return response; }