-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (40 loc) · 1.01 KB
/
Copy pathindex.js
File metadata and controls
44 lines (40 loc) · 1.01 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
const { execSync } = require('child_process')
const concurrently = require('concurrently')
const os = require('os')
const shouldBuild = process.argv.includes('--build')
const platform = os.platform()
const startCommand = platform === 'win32' ? 'start-windows' : 'start-linux'
if (shouldBuild) {
execSync('cd admin && yarn install && yarn build && cd ..', {
stdio: 'inherit'
})
execSync(`cd server && yarn install && cd ..`, { stdio: 'inherit' })
execSync('cd blog && yarn install && yarn build && cd ..', {
stdio: 'inherit'
})
}
const { result } = concurrently(
[
{
command: `cd server && yarn run start`,
name: 'server',
prefixColor: 'blue'
},
{
command: `cd blog/build && yarn run ${startCommand}`,
name: 'blog',
prefixColor: 'green'
}
],
{
prefix: 'name',
killOthers: ['failure', 'success']
}
)
result
.then(() => {
console.log('All applications are running...')
})
.catch(err => {
console.error('Something went wrong:', err)
})