File size: 759 Bytes
c2efbe6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
const { execSync, spawn } = require('child_process');
const path = require('path');

function runInstall(dir) {
  console.log(`Installing dependencies in ${dir}...`);
  execSync('npm install', { cwd: dir, stdio: 'inherit' });
}

function runStart(dir, name) {
  console.log(`Starting ${name}...`);
  const child = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['start'], {
    cwd: dir,
    stdio: 'inherit',
    shell: true,
  });
  child.on('close', code => {
    console.log(`${name} exited with code ${code}`);
  });
}

const backendDir = path.join(__dirname, 'backend');
const frontendDir = path.join(__dirname, 'frontend');

runInstall(backendDir);
runInstall(frontendDir);

runStart(backendDir, 'Backend');
runStart(frontendDir, 'Frontend');