MCPcopy Create free account
hub / github.com/babel/babel / runNodeScript

Function runNodeScript

Gulpfile.ts:220–239  ·  view source on GitHub ↗

* Run a Node.js script in a child process, so that it can run in parallel with * the other tasks

(args: string[], cwd?: string)

Source from the content-addressed store, hash-verified

218 * the other tasks
219 */
220function runNodeScript(args: string[], cwd?: string) {
221 return new Promise<void>((resolve, reject) => {
222 const child = spawn(process.execPath, args, { cwd, stdio: "inherit" });
223 child.on("error", reject);
224 child.on("close", (code, signal) => {
225 if (code === 0) {
226 resolve();
227 } else {
228 const command = `node ${args.join(" ")}`;
229 reject(
230 new Error(
231 signal
232 ? `${command} was killed by ${signal}`
233 : `${command} exited with code ${code}`
234 )
235 );
236 }
237 });
238 });
239}
240
241async function generateStandalone() {
242 log("Generating @babel/standalone files");

Callers 1

Gulpfile.tsFile · 0.85

Calls 3

spawnFunction · 0.85
onMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected