-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.ts
42 lines (40 loc) · 907 Bytes
/
cli.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
import { concurrently } from "concurrently";
import { rariBin } from "@mdn/rari";
import { filename } from "./filename.js";
const { commands, result } = concurrently(
[
{
command: `node ${filename}`,
name: "server",
env: {
RARI: true,
},
prefixColor: "red",
},
{
command: `${rariBin} serve -vv`,
name: "rari",
prefixColor: "blue",
},
],
{
killOthers: ["failure", "success"],
restartTries: 0,
handleInput: true,
inputStream: process.stdin,
}
);
const stop = new Promise((resolve, reject) => {
process.on("SIGINT", () => {
commands.forEach((cmd) => cmd.kill()); // Terminate all concurrently-run processes
reject();
});
result.finally(() => resolve(null));
});
try {
await stop;
console.log("All tasks completed successfully.");
} catch {
console.log("Killed ☠️");
}