1
1
const WARMUP_BUILDS = 10 ;
2
- const TOTAL_BUILDS = 20 ;
2
+ const TOTAL_BUILDS = 110 ;
3
3
4
4
module . exports = class BuildPlugin {
5
5
apply ( compiler ) {
@@ -8,22 +8,16 @@ module.exports = class BuildPlugin {
8
8
compiler . hooks . watchRun . tap ( "BuildPlugin" , ( ) => {
9
9
isWatching = true ;
10
10
} ) ;
11
- ( compiler . hooks . afterDone || compiler . hooks . done ) . tap ( "BuildPlugin" , ( ) => {
12
- setTimeout ( ( ) => {
13
- if ( counter === WARMUP_BUILDS ) console . log ( "#!# start" ) ;
14
- if ( isWatching && counter <= TOTAL_BUILDS ) console . log ( "#!# next" ) ;
15
- } , 10 ) ;
11
+ compiler . hooks . afterDone . tap ( "BuildPlugin" , ( ) => {
12
+ if ( counter === WARMUP_BUILDS ) console . log ( "#!# start" ) ;
13
+ if ( isWatching && counter <= TOTAL_BUILDS ) console . log ( "#!# next" ) ;
16
14
} ) ;
17
15
compiler . hooks . done . tap ( "BuildPlugin" , stats => {
18
16
if ( isWatching ) {
19
17
counter ++ ;
20
18
if ( counter <= WARMUP_BUILDS ) return ;
21
19
if ( counter > TOTAL_BUILDS ) {
22
- if ( compiler . watching ) {
23
- compiler . watching . close ( ) ;
24
- } else {
25
- process . nextTick ( ( ) => process . exit ( 0 ) ) ;
26
- }
20
+ process . nextTick ( ( ) => process . exit ( 0 ) ) ;
27
21
}
28
22
}
29
23
const { logging, time } = stats . toJson ( {
@@ -69,10 +63,7 @@ module.exports = class BuildPlugin {
69
63
if ( type !== "time" ) return ;
70
64
const ms = args [ 1 ] * 1000 + args [ 2 ] / 1000000 ;
71
65
console . log (
72
- `#!# ${ name } .${ args [ 0 ] . replace (
73
- / r e s t o r e c a c h e c o n t e n t \d .+ $ / ,
74
- "restore cache content"
75
- ) } = ${ ms } `
66
+ `#!# ${ name } .${ args [ 0 ] . replace ( / r e s t o r e c a c h e c o n t e n t \d .+ $ / , "restore cache content" ) } = ${ ms } `
76
67
) ;
77
68
} ;
78
69
}
0 commit comments