Skip to content

Commit 634ebb6

Browse files
ryansolidclaude
andcommitted
ci: track tree-shaken scenario sizes per PR with size-limit (#2883)
Five import-cost scenarios (signals floor / +createStore / +isPending, latest; the render+signal simple-app floor; a representative CSR app) with ~5% headroom limits as the tree-shaking regression gate — a re-coupled feature module costs hundreds of bytes against that headroom. The simple-app ceiling is pinned at 10 KB (brotli) deliberately. The size-limit action comments base-vs-head deltas on every PR; the retained-module-graph test in solid-signals stays the precise which-module diagnostic. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 5946c0e commit 634ebb6

7 files changed

Lines changed: 464 additions & 33 deletions

File tree

‎.github/workflows/size.yml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Size
2+
3+
# Tracks tree-shaken scenario costs per PR (#2883). The .size-limit.json
4+
# entries are import-cost scenarios, not file sizes: the limits are the strict
5+
# gate for tree-shaking regressions (a re-coupled feature module shows up as
6+
# hundreds of bytes against ~5% headroom), and the PR comment shows the
7+
# base-vs-head delta per scenario. The retained-module-graph assertions in
8+
# packages/solid-signals/tests/treeshake.test.ts remain the precise
9+
# which-module-re-coupled diagnostic; this is the trend tracker on top.
10+
on:
11+
pull_request:
12+
branches: [main, next]
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
jobs:
19+
size:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: pnpm/action-setup@v4
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version-file: ".nvmrc"
27+
cache: pnpm
28+
- uses: andresz1/size-limit-action@v1
29+
with:
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
package_manager: pnpm
32+
build_script: build

‎.size-limit.json‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"name": "signals: core floor (createSignal/Memo/Effect/Root/flush)",
4+
"path": "packages/solid-signals/dist/prod/index.js",
5+
"import": "{ createSignal, createMemo, createEffect, createRoot, flush }",
6+
"limit": "7.1 KB"
7+
},
8+
{
9+
"name": "signals: + createStore",
10+
"path": "packages/solid-signals/dist/prod/index.js",
11+
"import": "{ createSignal, createMemo, createEffect, createRoot, flush, createStore }",
12+
"limit": "11.6 KB"
13+
},
14+
{
15+
"name": "signals: + isPending/latest",
16+
"path": "packages/solid-signals/dist/prod/index.js",
17+
"import": "{ createSignal, createMemo, createEffect, createRoot, flush, isPending, latest }",
18+
"limit": "8.75 KB"
19+
},
20+
{
21+
"name": "app: render + one signal (the simple-app floor)",
22+
"path": "size-fixtures/minimal-app.js",
23+
"limit": "10 KB"
24+
},
25+
{
26+
"name": "app: CSR with Show/For/Loading/Errored/lazy",
27+
"path": "size-fixtures/csr-app.js",
28+
"limit": "12 KB"
29+
}
30+
]

‎package.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"publish": "pnpm run build && pnpm run types && pnpm run release:only",
2121
"bump": "changeset add",
2222
"release:only": "changeset publish",
23-
"format": "prettier --write --cache \"**/*.[tj]s?(x)\""
23+
"format": "prettier --write --cache \"**/*.[tj]s?(x)\"",
24+
"size": "size-limit"
2425
},
2526
"devDependencies": {
2627
"@babel/cli": "^7.18.9",
@@ -38,11 +39,15 @@
3839
"@rollup/plugin-json": "^6.0.0",
3940
"@rollup/plugin-node-resolve": "^15.0.1",
4041
"@rollup/plugin-replace": "^5.0.2",
42+
"@size-limit/preset-small-lib": "^12.1.0",
43+
"@solidjs/signals": "workspace:*",
44+
"@solidjs/web": "workspace:*",
4145
"@types/node": "^25.0.8",
4246
"@vitest/coverage-v8": "^4.1.6",
4347
"babel-plugin-transform-rename-import": "^2.3.0",
4448
"coveralls": "^3.1.1",
4549
"csstype": "^3.1.0",
50+
"esbuild": "^0.28.1",
4651
"jsdom": "^25.0.1",
4752
"ncp": "^2.0.0",
4853
"npm-run-all2": "^8.0.4",
@@ -53,6 +58,8 @@
5358
"rollup-plugin-copy": "^3.4.0",
5459
"seroval": "~1.5.4",
5560
"simple-git-hooks": "^2.8.1",
61+
"size-limit": "^12.1.0",
62+
"solid-js": "workspace:*",
5663
"symlink-dir": "^5.0.1",
5764
"tsconfig-replace-paths": "^0.0.11",
5865
"turbo": "^2.0.0",

0 commit comments

Comments
 (0)