forked from deepsarda/Aeona
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gateway.js
37 lines (33 loc) · 846 Bytes
/
gateway.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/gateway/dist');
} catch (e) {
console.log(e.toString('ascii').trim());
try {
execSync('rd /s /q packages\\gateway\\dist');
} catch (e) {
console.log(e.toString('ascii').trim());
}
}
console.log('Building Gateway');
try {
execSync('yarn gateway build');
} catch (e) {
console.log(e.toString('ascii').trim());
}
function runGateWay() {
const ls = exec('yarn gateway 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}`);
runGateWay();
});
}
runGateWay();