UNPKG

@easy-install/easy-install

Version:
21 lines (20 loc) 638 B
import { join } from 'path'; import { CLI_DIR, getBinName } from './ei'; import { existsSync } from 'fs'; import { execFileSync } from 'child_process'; import { install } from './install'; export async function run(url, bin, args = process.argv.slice(2), installDir = CLI_DIR) { const binPath = join(installDir, getBinName(bin)).replaceAll('\\', '/'); if (!existsSync(binPath)) { await install(url, bin, true, installDir, true); } try { execFileSync(binPath, args, { stdio: 'inherit', cwd: process.cwd(), }); } catch (e) { // FIXME: Ignore js errors } }