File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ if (!process.env.NODE_VER) {
16
16
17
17
exports . usage = '线上编译' ;
18
18
19
- exports . setOptions = function ( optimist ) { } ;
19
+ exports . setOptions = function ( optimist ) {
20
+ optimist . alias ( 'm' , 'min' ) ;
21
+ optimist . describe ( 'm' , '是否压缩资源' ) ;
22
+ } ;
20
23
21
24
exports . npmInstall = function ( ) {
22
25
var currentNpm = null ;
@@ -70,14 +73,16 @@ exports.npmInstall = function () {
70
73
} ;
71
74
72
75
exports . run = function ( options ) {
76
+ var min = options . m || options . min || true ;
77
+
73
78
// build process
74
79
process . stdout && process . stdout . write ( 'node version: ' ) && execute ( 'node -v' ) ;
75
80
process . stdout && process . stdout . write ( 'npm version: ' ) && execute ( 'npm -v' ) ;
76
81
execute ( 'ykit -v' ) ;
77
82
78
83
// build
79
84
log ( 'Start building.' ) ;
80
- execute ( 'ykit pack -m -q' ) ;
85
+ execute ( 'ykit pack -q ' + ( min ? '-m' : '' ) ) ;
81
86
clearGitHooks ( ) ;
82
87
clearNodeModules ( ) ;
83
88
log ( 'Finish building.\n' ) ;
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ if(!process.env.NODE_VER) {
17
17
exports . usage = '线上编译' ;
18
18
19
19
exports . setOptions = ( optimist ) => {
20
-
20
+ optimist . alias ( 'm' , 'min' ) ;
21
+ optimist . describe ( 'm' , '是否压缩资源' ) ;
21
22
} ;
22
23
23
24
exports . npmInstall = function ( ) {
@@ -75,14 +76,16 @@ exports.npmInstall = function() {
75
76
} ;
76
77
77
78
exports . run = function ( options ) {
79
+ const min = options . m || options . min || true ;
80
+
78
81
// build process
79
82
process . stdout && process . stdout . write ( 'node version: ' ) && execute ( 'node -v' ) ;
80
83
process . stdout && process . stdout . write ( 'npm version: ' ) && execute ( 'npm -v' ) ;
81
84
execute ( 'ykit -v' ) ;
82
85
83
86
// build
84
87
log ( 'Start building.' ) ;
85
- execute ( ' ykit pack -m -q' ) ;
88
+ execute ( ` ykit pack -q ${ min ? '-m' : '' } ` ) ;
86
89
clearGitHooks ( ) ;
87
90
clearNodeModules ( ) ;
88
91
log ( 'Finish building.\n' ) ;
You can’t perform that action at this time.
0 commit comments