@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).
41 lines (40 loc) • 1.3 kB
JavaScript
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;
}
}