forked from deepsarda/Aeona
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest.js
37 lines (33 loc) · 822 Bytes
/
rest.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
const fs = require('fs');
require('dotenv').config();
const { exec, execSync } = require('child_process');
try {
execSync('rm -rf packages/rest/dist');
} catch (e) {
console.log(e.toString('ascii').trim());
try {
execSync('rd /s /q packages\\rest\\dist');
} catch (e) {
console.log(e.toString('ascii').trim());
}
}
console.log('Building Rest');
try {
execSync('yarn rest build');
} catch (e) {
console.log(e.toString('ascii').trim());
}
function runRest() {
const ls = exec('yarn rest dev');
ls.stdout.on('data', (data) => {
console.log(data.toString('ascii').trim());
});
ls.stderr.on('data', (data) => {
console.error(data.toString('ascii').trim());
});
ls.on('close', (code) => {
console.log(`child process exited with code ${code}`);
runRest();
});
}
runRest();