UNPKG

@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).

94 lines (93 loc) 3.19 kB
import { re } from "@reliverse/relico"; import { cancel, group } from "@reliverse/rempts"; import { getAddonsChoice } from "./addons.js"; import { getApiChoice } from "./api.js"; import { getAuthChoice } from "./auth.js"; import { getBackendFrameworkChoice } from "./backend.js"; import { getDatabaseChoice } from "./database.js"; import { getDBSetupChoice } from "./database-setup.js"; import { getExamplesChoice } from "./examples.js"; import { getFrontendChoice } from "./frontend.js"; import { getGitChoice } from "./git.js"; import { getinstallChoice } from "./install.js"; import { getORMChoice } from "./orm.js"; import { getPackageManagerChoice } from "./package-manager.js"; import { getRuntimeChoice } from "./runtime.js"; export async function gatherConfig(flags, projectName, projectDir, relativePath) { const result = await group( { frontend: () => getFrontendChoice(flags.frontend, flags.backend), backend: ({ results }) => getBackendFrameworkChoice(flags.backend, results.frontend), runtime: ({ results }) => getRuntimeChoice(flags.runtime, results.backend), database: ({ results }) => getDatabaseChoice(flags.database, results.backend, results.runtime), orm: ({ results }) => getORMChoice( flags.orm, results.database !== "none", results.database, results.backend, results.runtime ), api: ({ results }) => getApiChoice(flags.api, results.frontend, results.backend), auth: ({ results }) => getAuthChoice(flags.auth, results.database !== "none", results.backend), addons: ({ results }) => getAddonsChoice(flags.addons, results.frontend), examples: ({ results }) => getExamplesChoice( flags.examples, results.database, results.frontend, results.backend, results.api ), dbSetup: ({ results }) => getDBSetupChoice( results.database ?? "none", flags.dbSetup, results.orm, results.backend ), git: () => getGitChoice(flags.git), packageManager: () => getPackageManagerChoice(flags.packageManager), install: () => getinstallChoice(flags.install) }, { onCancel: () => { cancel(re.red("Operation cancelled")); process.exit(0); } } ); if (result.backend === "convex") { result.runtime = "none"; result.database = "none"; result.orm = "none"; result.api = "none"; result.auth = false; result.dbSetup = "none"; result.examples = ["todo"]; } if (result.backend === "none") { result.runtime = "none"; result.database = "none"; result.orm = "none"; result.api = "none"; result.auth = false; result.dbSetup = "none"; result.examples = []; } return { projectName, projectDir, relativePath, frontend: result.frontend, backend: result.backend, runtime: result.runtime, database: result.database, orm: result.orm, auth: result.auth, addons: result.addons, examples: result.examples, git: result.git, packageManager: result.packageManager, install: result.install, dbSetup: result.dbSetup, api: result.api }; }