File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -85,14 +85,25 @@ export function main() {
8585 return output ;
8686 }
8787
88+ const displayedPackageRow = new Set ( ) ;
8889 output += 'Thanks for the PR! Here is the difference in size of the dist files between the base and the PR.\n' ;
8990 output += 'Please review the changes and make sure they are expected.\n\n' ;
9091 output += `<table>
9192 <thead><tr><th>File</th><th>Diff (B)</th><th>Diff (%)</th></tr></thead>
9293 <tbody>` ;
9394 for ( const [ file , details ] of files . entries ( ) ) {
95+ const isBridge = file . includes ( 'src/Bridge' ) ;
96+ const packageName = file . split ( '/' ) [ 1 ] ;
97+ const bridgeName = isBridge ? file . split ( '/' ) [ 4 ] : '' ;
98+ const fileShort = file . replace ( isBridge ? `src/${ packageName } /src/Bridge/${ bridgeName } /assets/dist/` : `src/${ packageName } /assets/dist/` , '' ) ;
99+
100+ if ( ! displayedPackageRow . has ( packageName ) ) {
101+ displayedPackageRow . add ( packageName ) ;
102+ output += `<tr><td colspan="3"><b>${ packageName } </b></td></tr>` ;
103+ }
104+
94105 output += `<tr>
95- <td><code>${ file } </code> ${ details . state === 'added' ? '(new)' : ( details . state === 'removed' ? '(deleted)' : '' ) } </td>
106+ <td><code>${ fileShort } </code> ${ details . state === 'added' ? '(new)' : ( details . state === 'removed' ? '(deleted)' : '' ) } </td>
96107 <td>
97108 Size: <code>${ formatBytes ( base [ file ] ?. size || 0 ) } </code> → <code>${ formatBytes ( pr [ file ] ?. size || 0 ) } </code><br>
98109 Gzip: <code>${ formatBytes ( base [ file ] ?. size_gz || 0 ) } </code> → <code>${ formatBytes ( pr [ file ] ?. size_gz || 0 ) } </code><br>
Original file line number Diff line number Diff line change @@ -3,9 +3,8 @@ name: Dist Files Size Diff
33on :
44 pull_request :
55 paths :
6- - ' src/*/**'
7- - ' !src/*/doc/**'
8- - ' .github/**'
6+ - ' src/*/assets/dist/**'
7+ - ' src/*/src/Bridge/*/assets/dist/**'
98
109jobs :
1110 dist-files-size-diff :
6059 with :
6160 result-encoding : string
6261 script : |
62+ console.log(context);
6363 const { main } = await import('${{ github.workspace }}/.github/generate-dist-files-size-diff.mjs')
6464
6565 return await main()
You can’t perform that action at this time.
0 commit comments