lockfile-sync-check
Version:
A command-line tool to check if your package manager's lockfile is in sync with the latest changes in your Git repository
21 lines (19 loc) • 756 B
JavaScript
import { execSync } from "node:child_process";
//#region src/install.ts
const installStartMessage = "📦 Installing dependencies...";
const installSuccessMessage = "✨ \x1B[32mDependencies installed successfully\x1B[0m";
const installErrorMessage = "❌ \x1B[31mFailed to install dependencies:\x1B[0m";
function installDependencies(packageManager) {
const installCommand = packageManager === "npm" ? "npm install" : packageManager === "yarn" ? "yarn" : "pnpm install";
try {
console.log(installStartMessage);
execSync(installCommand, { stdio: "inherit" });
console.log(installSuccessMessage);
process.exit(0);
} catch (error) {
console.error(installErrorMessage, error);
process.exit(1);
}
}
//#endregion
export { installDependencies };