-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.js
More file actions
45 lines (38 loc) · 1.12 KB
/
build.js
File metadata and controls
45 lines (38 loc) · 1.12 KB
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
var util = require('util');
var { spawn } = require('child_process');
function puts(error, stdout, stderr) {
util.puts(stdout, error, stderr);
}
var os = require('os');
let start;
if (os.type() === 'Linux')
start = spawn(
'concurrently "nodemon server.js" "cd client/backend && set PORT=3002 && npm start" "cd client/frontend && PORT=3001 npm start"',
{
shell: true
}
);
else if (os.type() === 'Darwin')
start = spawn(
'concurrently "nodemon server.js" "cd client/backend && set PORT=3002 && npm start" "cd client/frontend && PORT=3001 npm start"',
{
shell: true
}
);
else if (os.type() === 'Windows_NT')
start = spawn(
'concurrently "nodemon server.js" "cd client/backend && set PORT=3002 && npm start" "cd client/frontend && set PORT=3001 && npm start"',
{
shell: true
}
);
else throw new Error('Unsupported OS found: ' + os.type());
start.stdout.on('data', data => {
console.log(`stdout: ${data}`);
});
start.stderr.on('data', data => {
console.error(`stderr: ${data}`);
});
start.on('close', code => {
console.log(`child process exited with code ${code}`);
});