File tree 3 files changed +36
-3
lines changed
3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 67
67
"@types/ora" : " ^3.0.0" ,
68
68
"@types/p-waterfall" : " ^1.0.0" ,
69
69
"@types/pretty-bytes" : " ^5.1.0" ,
70
+ "@types/pretty-ms" : " ^4.0.0" ,
70
71
"@types/require-from-string" : " ^1.2.0" ,
71
72
"@types/resolve" : " ^0.0.8" ,
72
73
"@types/resolve-from" : " ^4.0.0" ,
78
79
"cac" : " ^6.4.2" ,
79
80
"commitizen" : " ^3.0.5" ,
80
81
"cz-conventional-changelog" : " ^2.1.0" ,
82
+ "gzip-size" : " ^5.0.0" ,
81
83
"husky" : " ^1.0.0-rc.13" ,
82
84
"jest" : " ^23.0.0" ,
83
85
"joycon" : " ^2.2.3" ,
84
86
"lint-staged" : " ^7.2.0" ,
85
87
"lodash" : " ^4.17.11" ,
86
88
"nswatch" : " ^0.2.0" ,
87
89
"p-waterfall" : " ^1.0.0" ,
88
- "gzip-size" : " ^5.0.0" ,
89
90
"prettier" : " ^1.15.2" ,
90
91
"pretty-bytes" : " ^5.1.0" ,
92
+ "pretty-ms" : " ^4.0.0" ,
91
93
"require-from-string" : " ^2.0.2" ,
92
94
"require-so-slow" : " ^1.2.0" ,
93
95
"resolve" : " ^1.10.0" ,
Original file line number Diff line number Diff line change 1
1
import path from 'path'
2
2
import colors from 'chalk'
3
3
import prettyBytes from 'pretty-bytes'
4
+ import formatTime from 'pretty-ms'
4
5
import textTable from 'text-table'
5
6
import resolveFrom from 'resolve-from'
6
7
import boxen from 'boxen'
@@ -338,6 +339,8 @@ export class Bundler {
338
339
// Add bundle to out assets Map
339
340
// So that we can log the stats when all builds completed
340
341
// Make sure this is the last plugin!
342
+ let startTime : number
343
+ let endTime : number
341
344
plugins . push ( {
342
345
name : 'record-bundle' ,
343
346
generateBundle ( outputOptions , _assets ) {
@@ -364,8 +367,19 @@ export class Bundler {
364
367
}
365
368
}
366
369
} ,
370
+ buildStart ( ) {
371
+ startTime = Date . now ( )
372
+ } ,
373
+ buildEnd ( ) {
374
+ endTime = Date . now ( )
375
+ } ,
367
376
async writeBundle ( ) {
368
- await printAssets ( assets , title . replace ( 'Bundle' , 'Bundled' ) )
377
+ await printAssets (
378
+ assets ,
379
+ `${ title . replace ( 'Bundle' , 'Bundled' ) } ${ colors . dim (
380
+ `(${ formatTime ( endTime - startTime ) } )`
381
+ ) } `
382
+ )
369
383
}
370
384
} )
371
385
@@ -629,7 +643,7 @@ async function printAssets(assets: Assets, title: string) {
629
643
} )
630
644
)
631
645
table . unshift ( [ 'File' , 'Size' , 'Gzipped' ] . map ( v => colors . dim ( v ) ) )
632
- logger . log ( title )
646
+ logger . success ( title )
633
647
logger . log (
634
648
boxen (
635
649
textTable ( table , {
Original file line number Diff line number Diff line change 922
922
resolved "https://registry.npmjs.org/@types/pretty-bytes/-/pretty-bytes-5.1.0.tgz#1df59db5c7def05dbbb0df2ad80b46863d9fafda"
923
923
integrity sha512-rc7x/HkZyguytBsCUVvcdARplUf0DsrRXqv3yO0v0CIgXuuwNlgYZRfYGCFHxr1CTnKHjCIJ13tB9t49ZixOIw==
924
924
925
+ " @types/pretty-ms@^4.0.0 " :
926
+ version "4.0.0"
927
+ resolved "https://registry.npmjs.org/@types/pretty-ms/-/pretty-ms-4.0.0.tgz#5e5177b9e447fbc8446e6fd2b09aea045971f11d"
928
+ integrity sha512-l5aIszYIm3s4jIL4wLDwajEml1w3E4zqGDDUgvnroX1ux6YAxsCrgRHLUafgrHFGTHlx7TpwiwSwcHV8IBvccw==
929
+
925
930
" @types/q@^1.5.1 " :
926
931
version "1.5.1"
927
932
resolved "https://registry.npmjs.org/@types/q/-/q-1.5.1.tgz#48fd98c1561fe718b61733daed46ff115b496e18"
@@ -6601,6 +6606,11 @@ parse-json@^4.0.0:
6601
6606
error-ex "^1.3.1"
6602
6607
json-parse-better-errors "^1.0.1"
6603
6608
6609
+ parse-ms@^2.0.0 :
6610
+ version "2.0.0"
6611
+ resolved "https://registry.npmjs.org/parse-ms/-/parse-ms-2.0.0.tgz#7b3640295100caf3fa0100ccceb56635b62f9d62"
6612
+ integrity sha512-AddiXFSLLCqj+tCRJ9MrUtHZB4DWojO3tk0NVZ+g5MaMQHF2+p2ktqxuoXyPFLljz/aUK0Nfhd/uGWnhXVXEyA==
6613
+
6604
6614
parse-passwd@^1.0.0 :
6605
6615
version "1.0.0"
6606
6616
resolved "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
@@ -7121,6 +7131,13 @@ pretty-format@^23.6.0:
7121
7131
ansi-regex "^3.0.0"
7122
7132
ansi-styles "^3.2.0"
7123
7133
7134
+ pretty-ms@^4.0.0 :
7135
+ version "4.0.0"
7136
+ resolved "https://registry.npmjs.org/pretty-ms/-/pretty-ms-4.0.0.tgz#31baf41b94fd02227098aaa03bd62608eb0d6e92"
7137
+ integrity sha512-qG66ahoLCwpLXD09ZPHSCbUWYTqdosB7SMP4OffgTgL2PBKXMuUsrk5Bwg8q4qPkjTXsKBMr+YK3Ltd/6F9s/Q==
7138
+ dependencies :
7139
+ parse-ms "^2.0.0"
7140
+
7124
7141
private@^0.1.6, private@^0.1.8 :
7125
7142
version "0.1.8"
7126
7143
resolved "https://registry.npmjs.org/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
You can’t perform that action at this time.
0 commit comments