File tree 2 files changed +15
-4
lines changed
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -85,14 +85,25 @@ export function main() {
85
85
return output ;
86
86
}
87
87
88
+ const displayedPackageRow = new Set ( ) ;
88
89
output += 'Thanks for the PR! Here is the difference in size of the dist files between the base and the PR.\n' ;
89
90
output += 'Please review the changes and make sure they are expected.\n\n' ;
90
91
output += `<table>
91
92
<thead><tr><th>File</th><th>Diff (B)</th><th>Diff (%)</th></tr></thead>
92
93
<tbody>` ;
93
94
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
+
94
105
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>
96
107
<td>
97
108
Size: <code>${ formatBytes ( base [ file ] ?. size || 0 ) } </code> → <code>${ formatBytes ( pr [ file ] ?. size || 0 ) } </code><br>
98
109
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
3
3
on :
4
4
pull_request :
5
5
paths :
6
- - ' src/*/**'
7
- - ' !src/*/doc/**'
8
- - ' .github/**'
6
+ - ' src/*/assets/dist/**'
7
+ - ' src/*/src/Bridge/*/assets/dist/**'
9
8
10
9
jobs :
11
10
dist-files-size-diff :
60
59
with :
61
60
result-encoding : string
62
61
script : |
62
+ console.log(context);
63
63
const { main } = await import('${{ github.workspace }}/.github/generate-dist-files-size-diff.mjs')
64
64
65
65
return await main()
You can’t perform that action at this time.
0 commit comments