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

41 lines (40 loc) 1.3 kB
import { re } from "@reliverse/relico"; import { relinka } from "@reliverse/relinka"; import { confirmPrompt } from "@reliverse/rempts"; import { installDependencies } from "nypm"; export async function askInstallDeps(cwd) { const DEPS_INSTALLED = false; const DEPS_MISSING = true; try { const shouldInstall = await confirmPrompt({ title: "Dependencies are missing in your project. Would you like to install them?", content: re.bold( "\u{1F6A8} Note: Certain addons will be disabled until the dependencies are installed." ) }); if (!shouldInstall) { relinka("info", "Skipping dependency installation."); return DEPS_MISSING; } relinka("info", "Installing dependencies..."); try { await installDependencies({ cwd }); relinka("success", "Dependencies installed successfully"); return DEPS_INSTALLED; } catch (error) { relinka( "error", "Failed to install dependencies:", error instanceof Error ? error.message : String(error) ); return DEPS_MISSING; } } catch (error) { relinka( "error", "An unexpected error occurred during dependency installation:", error instanceof Error ? error.message : String(error) ); return DEPS_MISSING; } }