@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
15 lines (14 loc) • 379 B
JavaScript
import { execa } from "execa";
export async function commandExists(command) {
try {
const isWindows = process.platform === "win32";
if (isWindows) {
const result2 = await execa("where", [command]);
return result2.exitCode === 0;
}
const result = await execa("which", [command]);
return result.exitCode === 0;
} catch {
return false;
}
}