-
Notifications
You must be signed in to change notification settings - Fork 87
/
starter.mjs
47 lines (44 loc) · 1.39 KB
/
starter.mjs
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
43
44
45
46
47
import { spawn } from "child_process";
import inquirer from "inquirer";
const { commands } = await inquirer.createPromptModule({
output: process.stderr,
})({
type: "checkbox",
name: "commands",
message: "Which services would you like to use?",
choices: [
{
checked: true,
value: '"npm run watch-tsc"',
name: "TypeScript Compilation (for regular packages)",
},
{
checked: true,
value: '"npm run watch-jest"',
name: "Jest (unit tests)",
},
{
checked: true,
value: '[ "npm run watch-sdk-ae" : "npm run watch-sdk-webpack" ]',
name: "SDK (in /publish/lmstudio)",
},
{
checked: false,
value: '[ "npm run watch-cli-package" : "npm run watch-cli-webpack" ]',
name: "CLI (in /packages/lms-cli and in /publish/cli)",
},
{
checked: false,
value: '"npm run watch-lmstudio"',
name: "LM Studio Installer (in /publish/lmstudio)",
},
],
});
// Yes, it is dangerous to do command concatenation without proper escaping. But in this case, we
// have full control over the commands. We are not using any user input to build the command.
const command = `npx stmux -e "(?:error TS| failed\\, )" -- [ ${commands.join(" .. ")} ]`;
const sp = spawn(command, { shell: true, stdio: "inherit" });
sp.on("exit", () => {
console.info("Processes terminated. The command ran was:");
console.info(command);
});