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

45 lines (44 loc) 1.41 kB
import fs from "@reliverse/relifso"; import { confirmPrompt } from "@reliverse/rempts"; import { downloadJsrDist } from "./nc-impl.js"; export async function showNativeCliMenu({ outputDir }) { const dirExists = await fs.pathExists(outputDir); if (dirExists) { try { const files = await fs.readdir(outputDir); if (files.length > 0) { const shouldOverwrite = await confirmPrompt({ title: "Bun runtime files already exist in the target directory.", content: "Do you want to proceed and potentially overwrite existing files?", defaultValue: false }); if (!shouldOverwrite) { return; } } } catch (error) { console.error("Error checking directory:", error); } } const shouldUseBunRuntime = await confirmPrompt({ title: "I see you have Bun installed, but the process was run using the Node.js runtime. Do you want to use the Bun runtime?", content: "Press <Enter> to allow me to download the CLI from JSR and install it globally. (The download speed depends on your internet connection.)", defaultValue: true }); if (!shouldUseBunRuntime) { return; } await downloadJsrDist( "rse", "cli", void 0, // This will pick the latest version automatically outputDir, true, 5, true, "Downloading Bun-native rse from JSR...", true, true ); }