File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 3
3
var fs = require ( 'fs' ) ;
4
4
var path = require ( 'path' ) ;
5
5
var shell = require ( 'shelljs' ) ;
6
+ var child_process = require ( 'child_process' ) ;
6
7
7
8
exports . usage = '线上编译' ;
8
9
@@ -17,9 +18,14 @@ exports.run = function (options) {
17
18
currentNpm = 'npm' ;
18
19
log ( '指定 npm 进行模块安装' ) ;
19
20
} else {
20
- currentNpm = 'npm_cache_share' ;
21
- log ( '指定 npm_cache_share 进行模块安装' ) ;
22
- process . stdout && process . stdout . write ( 'npm_cache_share version: ' ) && run ( 'npm_cache_share -V' ) ;
21
+ try {
22
+ child_process . execSync ( 'npm_cache_share -h' ) ;
23
+ currentNpm = 'npm_cache_share' ;
24
+ log ( '指定 npm_cache_share 进行模块安装' ) ;
25
+ } catch ( e ) {
26
+ currentNpm = 'npm' ;
27
+ log ( 'npm_cache_share 不存在,将使用 npm 进行模块安装' ) ;
28
+ }
23
29
}
24
30
25
31
// 确定 node 版本
Original file line number Diff line number Diff line change 3
3
var fs = require ( 'fs' ) ;
4
4
var path = require ( 'path' ) ;
5
5
var shell = require ( 'shelljs' ) ;
6
+ var child_process = require ( 'child_process' ) ;
6
7
7
8
exports . usage = '线上编译' ;
8
9
@@ -19,9 +20,14 @@ exports.run = function(options) {
19
20
currentNpm = 'npm' ;
20
21
log ( '指定 npm 进行模块安装' ) ;
21
22
} else {
22
- currentNpm = 'npm_cache_share' ;
23
- log ( '指定 npm_cache_share 进行模块安装' ) ;
24
- process . stdout && process . stdout . write ( 'npm_cache_share version: ' ) && run ( 'npm_cache_share -V' ) ;
23
+ try {
24
+ child_process . execSync ( 'npm_cache_share -h' ) ;
25
+ currentNpm = 'npm_cache_share' ;
26
+ log ( '指定 npm_cache_share 进行模块安装' ) ;
27
+ } catch ( e ) {
28
+ currentNpm = 'npm' ;
29
+ log ( 'npm_cache_share 不存在,将使用 npm 进行模块安装' ) ;
30
+ }
25
31
}
26
32
27
33
// 确定 node 版本
You can’t perform that action at this time.
0 commit comments