@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).
42 lines (41 loc) • 1.06 kB
JavaScript
import { re } from "@reliverse/relico";
import { cancel, isCancel, select } from "@reliverse/rempts";
import { DEFAULT_CONFIG } from "../constants.js";
export async function getRuntimeChoice(runtime, backend) {
if (backend === "convex" || backend === "none") {
return "none";
}
if (runtime !== void 0) return runtime;
if (backend === "next") {
return "node";
}
const runtimeOptions = [
{
value: "bun",
label: "Bun",
hint: "Fast all-in-one JavaScript runtime"
},
{
value: "node",
label: "Node.js",
hint: "Traditional Node.js runtime"
}
];
if (backend === "hono") {
runtimeOptions.push({
value: "workers",
label: "Cloudflare Workers (beta)",
hint: "Edge runtime on Cloudflare's global network"
});
}
const response = await select({
message: "Select runtime",
options: runtimeOptions,
initialValue: DEFAULT_CONFIG.runtime
});
if (isCancel(response)) {
cancel(re.red("Operation cancelled"));
process.exit(0);
}
return response;
}