File tree Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,47 @@ exports.run = (options) => {
17
17
lint = options . l || options . lin ,
18
18
project = new Project ( cwd ) ;
19
19
20
-
21
20
project . readConfig ( {
22
21
min : min
23
22
} ) . pack ( {
24
23
lint : lint
25
24
} , ( err , stats ) => {
26
- success ( 'Complete' ) ;
25
+ if ( err ) {
26
+ error ( err . red )
27
+ }
28
+
29
+ const statsInfo = stats . toJson ( { errorDetails : false } )
30
+
31
+ if ( statsInfo . errors . length > 0 ) {
32
+ statsInfo . errors . map ( ( err ) => {
33
+ error ( err . red )
34
+ info ( )
35
+ } )
36
+ }
37
+
38
+ // TODO 测试warning情况
39
+ if ( statsInfo . warnings . length > 0 ) {
40
+ statsInfo . warnings . map ( ( warning ) => {
41
+ warn ( err . yellow )
42
+ info ( )
43
+ } )
44
+ }
45
+
46
+ statsInfo . assets . map ( ( asset ) => {
47
+ const size = asset . size > 1024
48
+ ? ( asset . size / 1024 ) . toFixed ( 2 ) + ' kB'
49
+ : asset . size + ' bytes' ;
50
+
51
+ // .cache文件不显示
52
+ if ( ! endWith ( asset . name , ".cache" ) ) {
53
+ log ( 'packed asset: ' . gray + asset . name + ' - ' + size )
54
+ }
55
+ } )
56
+
57
+ success ( 'complete in ' + statsInfo . time + 'ms\n' )
58
+
59
+ function endWith ( string , suffix ) {
60
+ return string . indexOf ( suffix , string . length - suffix . length ) !== - 1 ;
61
+ }
27
62
} ) ;
28
63
} ;
You can’t perform that action at this time.
0 commit comments