66
77import * as fs from 'fs/promises' ;
88
9- import { MarkdownTable } from '../analyzer/markdown-tree-builder.js' ;
10- import { COMPONENT_CUSTOM_ELEMENTS } from '../component-custom-elements.js' ;
11- import { Bundle , Size , getBundleSize } from './bundle-size.js' ;
9+ import { MarkdownTable } from '../analyzer/markdown-tree-builder.js' ;
10+ import { COMPONENT_CUSTOM_ELEMENTS } from '../component-custom-elements.js' ;
11+ import { Bundle , Size , getBundleSize } from './bundle-size.js' ;
1212
1313// The bundles to track sizes for.
1414
@@ -28,7 +28,7 @@ const bundles: Bundle[] = [
2828 ) . map ( ( component ) => {
2929 const tsCustomElementPaths = COMPONENT_CUSTOM_ELEMENTS [ component ] ;
3030 const jsCustomElementPaths = tsCustomElementPaths . map ( ( tsPath ) =>
31- tsPath . replace ( / \. t s $ / , '.js' )
31+ tsPath . replace ( / \. t s $ / , '.js' ) ,
3232 ) ;
3333
3434 return {
@@ -41,14 +41,14 @@ const bundles: Bundle[] = [
4141// Compute bundle sizes.
4242
4343const bundleSizes = await Promise . all (
44- bundles . map ( ( bundle ) => getBundleSize ( bundle ) )
44+ bundles . map ( ( bundle ) => getBundleSize ( bundle ) ) ,
4545) ;
4646
4747// Create a markdown table with size data.
4848
4949const columns = [ 'Component' , 'gzip' , 'minified' , '*% CSS*' , 'Import' ] ;
5050const rows : string [ ] [ ] = [ ] ;
51- for ( const { name, size, inputs } of bundleSizes ) {
51+ for ( const { name, size, inputs} of bundleSizes ) {
5252 rows . push ( [
5353 `**${ camelToSentenceCase ( name ) } **` ,
5454 `**${ bytesToString ( size . gzip ) } **` ,
@@ -67,7 +67,7 @@ for (const { name, size, inputs } of bundleSizes) {
6767 getCssPercent ( input . size ) ,
6868 getImport ( input . input ) ,
6969 ] ;
70- } )
70+ } ) ,
7171 ) ;
7272 }
7373}
@@ -79,12 +79,12 @@ for (const row of rows) {
7979
8080// Update markdown file.
8181
82- const markdownContent = await fs . readFile ( 'docs/size.md' , { encoding : 'utf8' } ) ;
82+ const markdownContent = await fs . readFile ( 'docs/size.md' , { encoding : 'utf8' } ) ;
8383const updateTrackingStart = '<!-- MWC_UPDATE_TRACKING_START -->' ;
8484const updateTrackingEnd = '<!-- MWC_UPDATE_TRACKING_END -->' ;
8585
8686const now = new Date ( ) ;
87- const nowString = ` ${ now . getFullYear ( ) } - ${ now . getMonth ( ) + 1 } - ${ now . getDate ( ) } ` ;
87+ const nowString = now . toISOString ( ) . split ( 'T' ) [ 0 ] ;
8888
8989const newMarkdownContent = [
9090 markdownContent . substring ( 0 , markdownContent . indexOf ( updateTrackingStart ) ) ,
0 commit comments