@@ -31,8 +31,6 @@ async function bundlephobaInfo(key) {
3131 `https://bundlephobia.com/api/size?package=immutable@${ VERIFY_AGAINST_VERSION } `
3232 ) ;
3333
34- console . log ( res . status ) ;
35-
3634 if ( res . status !== 200 ) {
3735 throw new Error (
3836 `Unable to fetch bundlephobia in dist-stats.mjs. Status code is "${ res . status } "`
@@ -50,7 +48,7 @@ async function bundlephobaInfo(key) {
5048 return bundlephobaInfoCache [ key ] ;
5149}
5250
53- Promise . all ( [
51+ Promise . allSettled ( [
5452 fs . readFile ( 'dist/immutable.js' ) ,
5553 fs . readFile ( 'dist/immutable.min.js' ) ,
5654 bundlephobaInfo ( 'size' ) ,
@@ -59,23 +57,28 @@ Promise.all([
5957] )
6058 . then ( results =>
6159 results . map ( result =>
62- typeof result === 'number'
60+ typeof ( result === null || result === 'number' )
6361 ? result
6462 : Number ( Buffer . byteLength ( result , 'utf8' ) )
6563 )
6664 )
6765 . 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+ }
8184 } ) ;
0 commit comments