From 6bbfc52559e48f42d8b01256df4578f6b3fdf0ec Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 30 Oct 2025 19:06:48 +0000 Subject: [PATCH] feat: use minified builds for bundle size comparisons Add build:minified scripts that enable minification during builds, and configure the compressed-size-action to use these scripts. This ensures that bundle size measurements in PRs reflect actual code changes rather than being inflated by comments and whitespace, while keeping the published packages readable and unminified. Changes: - Add build:minified script to root package.json - Add build:minified scripts to @tanstack/db and @tanstack/react-db - Configure compressed-size-action to use build:minified script --- .github/workflows/pr.yml | 2 ++ package.json | 1 + packages/db/package.json | 1 + packages/react-db/package.json | 1 + 4 files changed, 5 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 472b8ec28..5ff230848 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -54,12 +54,14 @@ jobs: repo-token: "${{ secrets.GITHUB_TOKEN }}" pattern: "./packages/db/dist/**/*.{js,mjs}" comment-key: "db-package-size" + build-script: "build:minified" - name: Compressed Size Action - React DB Package uses: preactjs/compressed-size-action@v2 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" pattern: "./packages/react-db/dist/**/*.{js,mjs}" comment-key: "react-db-package-size" + build-script: "build:minified" build-example: name: Build Example Site runs-on: ubuntu-latest diff --git a/package.json b/package.json index be8334fcc..d85d17010 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "type": "module", "scripts": { "build": "pnpm --filter \"./packages/**\" build", + "build:minified": "pnpm --filter \"./packages/**\" build:minified", "changeset": "changeset", "changeset:publish": "changeset publish", "changeset:version": "changeset version && pnpm install --no-frozen-lockfile", diff --git a/packages/db/package.json b/packages/db/package.json index 64e8fdf69..f2e4129e3 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -49,6 +49,7 @@ ], "scripts": { "build": "vite build", + "build:minified": "vite build --minify", "dev": "vite build --watch", "lint": "eslint . --fix", "test": "npx vitest --run" diff --git a/packages/react-db/package.json b/packages/react-db/package.json index ccb0f6dbc..4773c6b33 100644 --- a/packages/react-db/package.json +++ b/packages/react-db/package.json @@ -54,6 +54,7 @@ }, "scripts": { "build": "vite build", + "build:minified": "vite build --minify", "dev": "vite build --watch", "test": "npx vitest --run", "lint": "eslint . --fix"