(
cwd: string,
args: string[],
options?: {
env?: Record<string, string>
input?: string
timeout?: number
}
)
| 28 | } |
| 29 | |
| 30 | export async function runCommand( |
| 31 | cwd: string, |
| 32 | args: string[], |
| 33 | options?: { |
| 34 | env?: Record<string, string> |
| 35 | input?: string |
| 36 | timeout?: number |
| 37 | } |
| 38 | ) { |
| 39 | try { |
| 40 | const childProcess = execa("node", [SHADCN_CLI_PATH, ...args], { |
| 41 | cwd, |
| 42 | env: { |
| 43 | ...process.env, |
| 44 | FORCE_COLOR: "0", |
| 45 | CI: "true", |
| 46 | ...options?.env, |
| 47 | }, |
| 48 | input: options?.input, |
| 49 | reject: false, |
| 50 | timeout: options?.timeout ?? 60000, |
| 51 | }) |
| 52 | |
| 53 | const result = await childProcess |
| 54 | |
| 55 | return { |
| 56 | stdout: result.stdout || "", |
| 57 | stderr: result.stderr || "", |
| 58 | exitCode: result.exitCode ?? 0, |
| 59 | } |
| 60 | } catch (error: any) { |
| 61 | return { |
| 62 | stdout: error.stdout || "", |
| 63 | stderr: error.stderr || error.message || "", |
| 64 | exitCode: error.exitCode ?? 1, |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | export async function npxShadcn( |
| 70 | cwd: string, |
no outgoing calls
no test coverage detected