-
Notifications
You must be signed in to change notification settings - Fork 46
/
start_all.js
57 lines (52 loc) · 1.46 KB
/
start_all.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
53
54
55
56
57
const concurrently = require('concurrently');
let runWithApps = true;
let noWatch = false;
const myCmd = process.argv.slice(2).join(' ').trim();
if (myCmd.includes('--no-apps')) {
runWithApps = false;
}
if (myCmd.includes('--no-watch')) {
noWatch = true;
}
const commands = [
{
cwd: 'ilc',
command: `${noWatch ? 'npx cross-env NODE_ENV=production' : ''} npm run ${noWatch ? 'start' : 'dev'}`,
name: 'ilc',
},
{
cwd: 'registry',
command: `npm run migrate && npm run seed && npm run ${noWatch ? 'start' : 'dev'}`,
name: 'registry',
},
{
cwd: 'registry',
command: 'npx ts-node lde/oauth-server.ts',
name: 'oauth-server',
},
];
if (!noWatch) {
commands.push({ cwd: 'registry/client', command: 'npm run build:watch', name: 'registry:ui' });
}
if (runWithApps) {
commands.push({
command:
'docker rm -f ilc-demo-apps && docker pull namecheap/ilc-demo-apps && docker run --rm --name ilc-demo-apps -p 8234-8240:8234-8240 namecheap/ilc-demo-apps',
name: 'demo-apps',
});
}
concurrently(commands, {
prefix: 'name',
killOthers: ['failure', 'success'],
killSignal: 'SIGTERM',
prefixColors: ['auto'],
}).result.then(
() => {
console.log('concurrently was finished successfully');
process.exit(0);
},
(err) => {
console.error('concurrently was finished with error', err);
process.exit(1);
},
);