forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.js
53 lines (47 loc) · 1.55 KB
/
start.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
#!/usr/bin/env node
const portfinder = require('portfinder');
const concurrently = require('concurrently');
require('dotenv').config();
const basePort = 8082;
portfinder
.getPortPromise({
port: basePort,
})
.then((port) => {
const devServer = `webpack-dev-server --config config/webpack/webpack.dev.js --port ${port} --env platform=desktop`;
const buildMain = 'webpack watch --config config/webpack/webpack.desktop.js --config-name desktop-main --mode=development';
const env = {
PORT: port,
NODE_ENV: 'development',
};
const processes = [
{
command: buildMain,
name: 'Main',
prefixColor: 'blue.dim',
env,
},
{
command: devServer,
name: 'Renderer',
prefixColor: 'red.dim',
env,
},
{
command: `wait-port dev.new.expensify.com:${port} && npx electronmon ./desktop/dev.js`,
name: 'Electron',
prefixColor: 'cyan.dim',
env,
},
];
return concurrently(processes, {
inputStream: process.stdin,
prefix: 'name',
// Like Harry Potter and he-who-must-not-be-named, "neither can live while the other survives"
killOthers: ['success', 'failure'],
}).then(
() => process.exit(0),
() => process.exit(1),
);
})
.catch(() => process.exit(1));