@@ -31,8 +31,6 @@ async function bundlephobaInfo(key) {
31
31
`https://bundlephobia.com/api/size?package=immutable@${ VERIFY_AGAINST_VERSION } `
32
32
) ;
33
33
34
- console . log ( res . status ) ;
35
-
36
34
if ( res . status !== 200 ) {
37
35
throw new Error (
38
36
`Unable to fetch bundlephobia in dist-stats.mjs. Status code is "${ res . status } "`
@@ -50,7 +48,7 @@ async function bundlephobaInfo(key) {
50
48
return bundlephobaInfoCache [ key ] ;
51
49
}
52
50
53
- Promise . all ( [
51
+ Promise . allSettled ( [
54
52
fs . readFile ( 'dist/immutable.js' ) ,
55
53
fs . readFile ( 'dist/immutable.min.js' ) ,
56
54
bundlephobaInfo ( 'size' ) ,
@@ -59,23 +57,28 @@ Promise.all([
59
57
] )
60
58
. then ( results =>
61
59
results . map ( result =>
62
- typeof result === 'number'
60
+ typeof ( result === null || result === 'number' )
63
61
? result
64
62
: Number ( Buffer . byteLength ( result , 'utf8' ) )
65
63
)
66
64
)
67
65
. then ( ( [ rawNew , minNew , minOld , zipNew , zipOld ] ) => {
68
- console . log ( ` Raw: ${ space ( 14 , bytes ( rawNew ) . cyan ) } ` ) ;
69
- console . log (
70
- ` Min: ${ space ( 14 , bytes ( minNew ) . cyan ) } ${ percentage (
71
- minNew ,
72
- rawNew
73
- ) } ${ space ( 15 , diff ( minNew , minOld ) ) } `
74
- ) ;
75
- console . log (
76
- ` Zip: ${ space ( 14 , bytes ( zipNew ) . cyan ) } ${ percentage (
77
- zipNew ,
78
- rawNew
79
- ) } ${ space ( 15 , diff ( zipNew , zipOld ) ) } `
80
- ) ;
66
+ console . log ( ` Raw: ${ space ( 14 , bytes ( rawNew . value ) . cyan ) } ` ) ;
67
+ if ( minOld . status === 'fulfilled' ) {
68
+ console . log (
69
+ ` Min: ${ space ( 14 , bytes ( minNew . value ) . cyan ) } ${ percentage (
70
+ minNew . value ,
71
+ rawNew . value
72
+ ) } ${ space ( 15 , diff ( minNew . value , minOld . value ) ) } `
73
+ ) ;
74
+ }
75
+
76
+ if ( zipOld . status === 'fulfilled' ) {
77
+ console . log (
78
+ ` Zip: ${ space ( 14 , bytes ( zipNew . value ) . cyan ) } ${ percentage (
79
+ zipNew . value ,
80
+ rawNew . value
81
+ ) } ${ space ( 15 , diff ( zipNew . value , zipOld . value ) ) } `
82
+ ) ;
83
+ }
81
84
} ) ;
0 commit comments