-
Notifications
You must be signed in to change notification settings - Fork 133
/
dev.mjs
47 lines (39 loc) · 1.3 KB
/
dev.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 { execSync, spawn } from 'child_process';
import fs from 'fs';
(async () => {
await execSync(`yarn`, { stdio: 'inherit', shell: true });
const buildAndWatch = async (folder, skipWatch = false) => {
const log = (message) => console.log(`${folder}: ${message}`);
if (skipWatch) {
log('skip watch project')
return;
}
if (!fs.existsSync(folder + '/dist/')) {
await execSync(`yarn build --cwd ${folder}`, { stdio: 'inherit', shell: true });
}
await new Promise((resolve) => {
log('Watching changes...');
const child = spawn('yarn', ['--cwd', folder, 'dev'], { shell: true });
child.stdout.on('data', log);
child.stderr.on('data', log);
child.on('close', (code) => {
resolve(code)
});
});
}
console.log('Building and watching...');
await Promise.all([
"interfaces",
"common",
"logger-service",
"notification-service",
"frontend",
"auth-service",
"guardian-service",
"api-gateway",
"analytics-service",
"mrv-sender",
"ipfs-client",
"topic-viewer"
].map(project => buildAndWatch(project, project === "frontend")));
})();