-
Notifications
You must be signed in to change notification settings - Fork 0
/
select.js
52 lines (45 loc) · 1.37 KB
/
select.js
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
48
49
50
51
52
const { default: inquirer } = require('inquirer');
const { spawn } = require('child_process');
const questions = [
{
type: 'list',
name: 'file',
message: 'Whats the project you want to run?:',
choices: [
'Entry-LTS',
'Admission-Admin-LTS',
'Admission-LTS',
'Entry-Auth',
'EntryDesignSystem',
],
},
];
inquirer.prompt(questions).then((answers) => {
let command, args;
if (answers.file === 'Entry-Auth') {
command = 'yarn';
args = ['workspace', '@entrydsm/auth', 'run', 'start'];
} else if (answers.file === 'EntryDesignSystem') {
command = 'yarn';
args = ['workspace', '@entrydsm/design-system', 'run', 'start'];
} else if (answers.file === 'Admission-LTS') {
command = 'yarn';
args = ['workspace', '@entrydsm/admission', 'run', 'start'];
} else if (answers.file === 'Admission-Admin-LTS') {
command = 'yarn';
args = ['workspace', '@entrydsm/admin', 'run', 'start'];
} else if (answers.file === 'Entry-LTS') {
command = 'yarn';
args = ['workspace', '@entrydsm/main', 'run', 'start'];
}
const child = spawn(command, args, { shell: true });
child.stdout.on('data', (data) => {
console.log(`${data}`);
});
child.stderr.on('data', (data) => {
console.error(`${data}`);
});
child.on('close', (code) => {
console.log(`Child process exited with code ${code}`);
});
});