mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
17 lines
384 B
TypeScript
17 lines
384 B
TypeScript
import { execa } from "execa";
|
|
|
|
export async function commandExists(command: string): Promise<boolean> {
|
|
try {
|
|
const isWindows = process.platform === "win32";
|
|
if (isWindows) {
|
|
const result = await execa("where", [command]);
|
|
return result.exitCode === 0;
|
|
}
|
|
|
|
const result = await execa("which", [command]);
|
|
return result.exitCode === 0;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|