UNPKG

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