6
6
7
7
import * as fs from 'fs/promises' ;
8
8
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' ;
12
12
13
13
// The bundles to track sizes for.
14
14
@@ -28,7 +28,7 @@ const bundles: Bundle[] = [
28
28
) . map ( ( component ) => {
29
29
const tsCustomElementPaths = COMPONENT_CUSTOM_ELEMENTS [ component ] ;
30
30
const jsCustomElementPaths = tsCustomElementPaths . map ( ( tsPath ) =>
31
- tsPath . replace ( / \. t s $ / , '.js' )
31
+ tsPath . replace ( / \. t s $ / , '.js' ) ,
32
32
) ;
33
33
34
34
return {
@@ -41,14 +41,14 @@ const bundles: Bundle[] = [
41
41
// Compute bundle sizes.
42
42
43
43
const bundleSizes = await Promise . all (
44
- bundles . map ( ( bundle ) => getBundleSize ( bundle ) )
44
+ bundles . map ( ( bundle ) => getBundleSize ( bundle ) ) ,
45
45
) ;
46
46
47
47
// Create a markdown table with size data.
48
48
49
49
const columns = [ 'Component' , 'gzip' , 'minified' , '*% CSS*' , 'Import' ] ;
50
50
const rows : string [ ] [ ] = [ ] ;
51
- for ( const { name, size, inputs } of bundleSizes ) {
51
+ for ( const { name, size, inputs} of bundleSizes ) {
52
52
rows . push ( [
53
53
`**${ camelToSentenceCase ( name ) } **` ,
54
54
`**${ bytesToString ( size . gzip ) } **` ,
@@ -67,7 +67,7 @@ for (const { name, size, inputs } of bundleSizes) {
67
67
getCssPercent ( input . size ) ,
68
68
getImport ( input . input ) ,
69
69
] ;
70
- } )
70
+ } ) ,
71
71
) ;
72
72
}
73
73
}
@@ -79,12 +79,12 @@ for (const row of rows) {
79
79
80
80
// Update markdown file.
81
81
82
- const markdownContent = await fs . readFile ( 'docs/size.md' , { encoding : 'utf8' } ) ;
82
+ const markdownContent = await fs . readFile ( 'docs/size.md' , { encoding : 'utf8' } ) ;
83
83
const updateTrackingStart = '<!-- MWC_UPDATE_TRACKING_START -->' ;
84
84
const updateTrackingEnd = '<!-- MWC_UPDATE_TRACKING_END -->' ;
85
85
86
86
const now = new Date ( ) ;
87
- const nowString = ` ${ now . getFullYear ( ) } - ${ now . getMonth ( ) + 1 } - ${ now . getDate ( ) } ` ;
87
+ const nowString = now . toISOString ( ) . split ( 'T' ) [ 0 ] ;
88
88
89
89
const newMarkdownContent = [
90
90
markdownContent . substring ( 0 , markdownContent . indexOf ( updateTrackingStart ) ) ,
0 commit comments