everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
1 lines • 1.45 kB
Source Map (JSON)
{"version":3,"file":"run.cjs","names":[],"sources":["../../src/utils/run.ts"],"sourcesContent":["import { execa } from \"execa\";\n\ntype RunResult = { stdout: string; stderr: string; exitCode: number };\n\nexport async function run(\n cmd: string,\n args: string[],\n options: { cwd?: string; env?: Record<string, string>; capture?: boolean } = {},\n): Promise<RunResult | undefined> {\n const proc = await execa(cmd, args, {\n cwd: options.cwd,\n env: options.env ? { ...(process.env as Record<string, string>), ...options.env } : process.env,\n stdio: options.capture ? \"pipe\" : \"inherit\",\n reject: false,\n });\n\n if (!options.capture) {\n const exitCode = proc.exitCode ?? 0;\n if (exitCode !== 0) {\n throw new Error(`${cmd} ${args.join(\" \")} failed with exit code ${exitCode}`);\n }\n return;\n }\n\n const result = {\n stdout: proc.stdout ?? \"\",\n stderr: proc.stderr ?? \"\",\n exitCode: proc.exitCode ?? 0,\n };\n return result;\n}\n"],"mappings":";;;;AAIA,eAAsB,IACpB,KACA,MACA,UAA6E,EAAE,EAC/C;CAChC,MAAM,OAAO,uBAAY,KAAK,MAAM;EAClC,KAAK,QAAQ;EACb,KAAK,QAAQ,MAAM;GAAE,GAAI,QAAQ;GAAgC,GAAG,QAAQ;GAAK,GAAG,QAAQ;EAC5F,OAAO,QAAQ,UAAU,SAAS;EAClC,QAAQ;EACT,CAAC;AAEF,KAAI,CAAC,QAAQ,SAAS;EACpB,MAAM,WAAW,KAAK,YAAY;AAClC,MAAI,aAAa,EACf,OAAM,IAAI,MAAM,GAAG,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,yBAAyB,WAAW;AAE/E;;AAQF,QAAO;EAJL,QAAQ,KAAK,UAAU;EACvB,QAAQ,KAAK,UAAU;EACvB,UAAU,KAAK,YAAY;EAEhB"}