-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.js
48 lines (39 loc) · 987 Bytes
/
run.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
var cluster = require('cluster');
var config = require('./config');
var child_process = require('child_process');
// 同步处理
//有权限的话可以不用加sudo
console.info('安装工程依赖包....');
child_process.execSync('sudo npm install', {
stdio: 'inherit'
});
console.info('安装静态工程依赖包....');
child_process.execSync('sudo npm install', {
stdio: 'inherit',
cwd: './static',
});
if (config.isOnline) {
console.info('压缩并发布线上环境静态....');
child_process.execSync('gulp dist', {
stdio: 'inherit',
cwd: './static',
});
} else {
console.info('压缩并发布测试环境静态....');
child_process.execSync('gulp', {
stdio: 'inherit',
cwd: './static',
});
}
//node
// console.info('启动中....');
// child_process.execSync('node app.js', {
// stdio: 'inherit',
// cwd: './',
// });
//建议用pm2守护
console.info('启动中....');
child_process.execSync('pm2 start app.js', {
stdio: 'inherit',
cwd: './',
});