Skip to content

Commit a95b3e8

Browse files
authored
chore(ci): track bundle size (#1630)
* chore(ci): track bundle size --------- Co-authored-by: pauldambra <pauldambra@users.noreply.github.com>
1 parent 965b0a9 commit a95b3e8

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

.github/workflows/ci-cd.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ jobs:
3434
# run: PUPPETEER_EXECUTABLE_PATH=${{ steps.setup-chrome.outputs.chrome-path }} PUPPETEER_HEADLESS=true xvfb-run --server-args="-screen 0 1920x1080x24" yarn test
3535
run: PUPPETEER_HEADLESS=true xvfb-run --server-args="-screen 0 1920x1080x24" yarn test
3636

37+
- name: Check bundle sizes
38+
uses: preactjs/compressed-size-action@v2
39+
with:
40+
install-script: "yarn install --frozen-lockfile"
41+
build-script: "build:all"
42+
compression: "none"
43+
pattern: "**/dist/*.{js,cjs,mjs,css}"
44+
3745
- name: Upload diff images to GitHub
3846
uses: actions/upload-artifact@v4
3947
if: failure()

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ dist
3535
# for vite
3636
vite.config.js.timestamp-*
3737
vite.config.ts.timestamp-*
38+
39+
# bundle analysis files
40+
*-bundle-analysis.html

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"markdownlint": "^0.25.1",
3939
"markdownlint-cli": "^0.31.1",
4040
"prettier": "2.8.4",
41+
"rollup-plugin-visualizer": "^5.12.0",
4142
"turbo": "^2.0.4",
4243
"typescript": "^5.4.5"
4344
},

vite.config.default.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { defineConfig, LibraryOptions, LibraryFormats, Plugin } from 'vite';
55
import { build, Format } from 'esbuild';
66
import { resolve } from 'path';
77
import { umdWrapper } from 'esbuild-plugin-umd-wrapper';
8+
import * as fs from 'node:fs';
9+
import { visualizer } from 'rollup-plugin-visualizer';
810

911
// don't empty out dir if --watch flag is passed
1012
const emptyOutDir = !process.argv.includes('--watch');
@@ -161,6 +163,10 @@ export default function (
161163
},
162164
}),
163165
minifyAndUMDPlugin({ name, outDir }),
166+
visualizer({
167+
filename: resolve(__dirname, name + '-bundle-analysis.html'), // Path for the HTML report
168+
open: false, // don't Automatically open the report in the browser
169+
}),
164170
{
165171
name: 'remove-worker-inline',
166172
enforce: 'pre',

yarn.lock

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4534,6 +4534,11 @@ define-data-property@^1.0.1, define-data-property@^1.1.4:
45344534
es-errors "^1.3.0"
45354535
gopd "^1.0.1"
45364536

4537+
define-lazy-prop@^2.0.0:
4538+
version "2.0.0"
4539+
resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f"
4540+
integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==
4541+
45374542
define-properties@^1.2.0, define-properties@^1.2.1:
45384543
version "1.2.1"
45394544
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c"
@@ -6258,7 +6263,7 @@ is-date-object@^1.0.1:
62586263
dependencies:
62596264
has-tostringtag "^1.0.0"
62606265

6261-
is-docker@^2.0.0:
6266+
is-docker@^2.0.0, is-docker@^2.1.1:
62626267
version "2.2.1"
62636268
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
62646269
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
@@ -7915,6 +7920,15 @@ onetime@^6.0.0:
79157920
dependencies:
79167921
mimic-fn "^4.0.0"
79177922

7923+
open@^8.4.0:
7924+
version "8.4.2"
7925+
resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9"
7926+
integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==
7927+
dependencies:
7928+
define-lazy-prop "^2.0.0"
7929+
is-docker "^2.1.1"
7930+
is-wsl "^2.2.0"
7931+
79187932
optionator@^0.9.3:
79197933
version "0.9.4"
79207934
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734"
@@ -8186,6 +8200,11 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1:
81868200
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
81878201
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
81888202

8203+
picomatch@^4.0.2:
8204+
version "4.0.2"
8205+
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab"
8206+
integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==
8207+
81898208
pify@^4.0.1:
81908209
version "4.0.1"
81918210
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
@@ -8852,6 +8871,16 @@ rimraf@~2.4.0:
88528871
dependencies:
88538872
glob "^6.0.1"
88548873

8874+
rollup-plugin-visualizer@^5.12.0:
8875+
version "5.14.0"
8876+
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.14.0.tgz#be82d43fb3c644e396e2d50ac8a53d354022d57c"
8877+
integrity sha512-VlDXneTDaKsHIw8yzJAFWtrzguoJ/LnQ+lMpoVfYJ3jJF4Ihe5oYLAqLklIK/35lgUY+1yEzCkHyZ1j4A5w5fA==
8878+
dependencies:
8879+
open "^8.4.0"
8880+
picomatch "^4.0.2"
8881+
source-map "^0.7.4"
8882+
yargs "^17.5.1"
8883+
88558884
rollup@^4.13.0:
88568885
version "4.18.0"
88578886
resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.18.0.tgz#497f60f0c5308e4602cf41136339fbf87d5f5dda"
@@ -9248,7 +9277,7 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
92489277
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
92499278
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
92509279

9251-
source-map@^0.7.3:
9280+
source-map@^0.7.3, source-map@^0.7.4:
92529281
version "0.7.4"
92539282
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656"
92549283
integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==
@@ -10792,7 +10821,7 @@ yargs@^16.2.0:
1079210821
y18n "^5.0.5"
1079310822
yargs-parser "^20.2.2"
1079410823

10795-
yargs@^17.3.1, yargs@^17.7.1:
10824+
yargs@^17.3.1, yargs@^17.5.1, yargs@^17.7.1:
1079610825
version "17.7.2"
1079710826
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
1079810827
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==

0 commit comments

Comments
 (0)