From a8151e34b329615d909194a5a2324602694e6b18 Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Sat, 13 Jan 2024 10:42:52 -0800 Subject: [PATCH 1/3] Change the vite chunk filename hash usage - Change to more closely match the . syntax we use with webpack - This shoudl fix some issues with our size compare as well --- packages/desktop-client/vite.config.mts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/desktop-client/vite.config.mts b/packages/desktop-client/vite.config.mts index 6caaf0f5846..abcea479e28 100644 --- a/packages/desktop-client/vite.config.mts +++ b/packages/desktop-client/vite.config.mts @@ -122,10 +122,10 @@ export default defineConfig(async ({ mode }) => { } else if (/woff|woff2/.test(extType)) { extType = 'media'; } - return `static/${extType}/[name]-[hash][extname]`; + return `static/${extType}/[name].[hash][extname]`; }, - chunkFileNames: 'static/js/[name]-[hash].js', - entryFileNames: 'static/js/[name]-[hash].js', + chunkFileNames: 'static/js/[name].[hash].js', + entryFileNames: 'static/js/[name].[hash].js', }, }, }, From 78bb8278c81d152f3f3b4fd2781c7b95cd641814 Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Sat, 13 Jan 2024 11:31:02 -0800 Subject: [PATCH 2/3] Account for chunks being base64wq --- .github/workflows/size-compare.yml | 4 ++++ packages/desktop-client/vite.config.mts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/size-compare.yml b/.github/workflows/size-compare.yml index 40da2aad617..2db0cd588b7 100644 --- a/.github/workflows/size-compare.yml +++ b/.github/workflows/size-compare.yml @@ -64,7 +64,11 @@ jobs: - name: Strip content hashes from stats files run: | + sed -i -E 's/index\.[0-9a-zA-Z_-]{8,}\./index./g' ./head/web-stats.json + sed -i -E 's/\.[0-9a-zA-Z_-]{8,}\.chunk\././g' ./head/web-stats.json sed -i -E 's/\.[0-9a-f]{8,}\././g' ./head/*.json + sed -i -E 's/index\.[0-9a-zA-Z_-]{8,}\./index./g' ./base/web-stats.json + sed -i -E 's/\.[0-9a-zA-Z_-]{8,}\.chunk\././g' ./base/web-stats.json sed -i -E 's/\.[0-9a-f]{8,}\././g' ./base/*.json - uses: twk3/rollup-size-compare-action@v1.0.0 with: diff --git a/packages/desktop-client/vite.config.mts b/packages/desktop-client/vite.config.mts index abcea479e28..a46ef6d6e8b 100644 --- a/packages/desktop-client/vite.config.mts +++ b/packages/desktop-client/vite.config.mts @@ -124,7 +124,7 @@ export default defineConfig(async ({ mode }) => { } return `static/${extType}/[name].[hash][extname]`; }, - chunkFileNames: 'static/js/[name].[hash].js', + chunkFileNames: 'static/js/[name].[hash].chunk.js', entryFileNames: 'static/js/[name].[hash].js', }, }, From 1bbb10804f28ab75e938c3fc645b6cbc7c5ab4bd Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Sat, 13 Jan 2024 12:34:28 -0800 Subject: [PATCH 3/3] Test that this actually works --- .github/workflows/size-compare.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/size-compare.yml b/.github/workflows/size-compare.yml index 2db0cd588b7..32e5f40b736 100644 --- a/.github/workflows/size-compare.yml +++ b/.github/workflows/size-compare.yml @@ -12,7 +12,7 @@ name: Compare Sizes ########################################################################################## on: - pull_request_target: + pull_request: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}