Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix: remove bundle size tracking from CI

esengine79398ddae540
diff --git a/.github/bundle-size-baselines.json b/.github/bundle-size-baselines.json
deleted file mode 100644
index 844e37dd2..000000000
--- a/.github/bundle-size-baselines.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "wasm/web/esengine.js": {
- "size": 63544,
- "sizeKB": 62,
- "sha256": "8b081a50947a742cd6285baf8f6a7bb04028df45f26e19001a1a98d2f5b82fa1"
- },
- "wasm/web/esengine.wasm": {
- "size": 674052,
- "sizeKB": 658,
- "sha256": "8f8032bb10ad9a7cdfb7e8ef4f7ddb99a1ac573984fb3a16450747618606f5b6"
- },
- "wasm/web/physics.js": {
- "size": 16795,
- "sizeKB": 16,
- "sha256": "b5f252c4dcbb8de720dd22dde078707b585a3f3e2ee9795e5456d6b2b892ab47"
- },
- "wasm/web/physics.wasm": {
- "size": 162968,
- "sizeKB": 159,
- "sha256": "5a4202e8b1dac47ce64f39b313137380f9208eec271b1ca0978da9bac6bfc88b"
- },
- "sdk/esm/esengine.js": {
- "size": 107062,
- "sizeKB": 105,
- "sha256": "84c082052b13799bfd608980d51fc177461b3fd49e4b58512092b4be5dea3285"
- },
- "sdk/esm/esengine.d.ts": {
- "size": 87951,
- "sizeKB": 86,
- "sha256": "78a8310b68eec362044d0d2d8942c5ee2e4d0328fd06ba9ef346e375d7d518e2"
- },
- "sdk/esm/wasm.js": {
- "size": 34,
- "sizeKB": 0,
- "sha256": "4ce8696ae2a3a575db7c6f1edef28600f8a7ccad554ad289ca8aa7a00164d705"
- },
- "sdk/esm/wasm.d.ts": {
- "size": 13688,
- "sizeKB": 13,
- "sha256": "75e912de32f7a61f2a27937236c0bcdc5e4ac8421c667f0b985579bd7e848df5"
- }
-}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d01c7a699..75d3dcd0a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -78,33 +78,7 @@ jobs:
run: pnpm install
- name: Build all targets
- run: node build-tools/cli.js build -t all --manifest --no-sync
-
- - name: Track bundle sizes
- run: node build-tools/track-bundle-size.js check
-
- - name: Upload bundle size report
- if: github.event_name == 'pull_request'
- uses: actions/upload-artifact@v4
- with:
- name: bundle-size-report
- path: build/manifest.json
-
- - name: Comment PR with bundle size
- if: github.event_name == 'pull_request'
- uses: actions/github-script@v7
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- const { execSync } = require('child_process');
- const comment = execSync('node build-tools/track-bundle-size.js pr-comment', { encoding: 'utf-8' });
-
- github.rest.issues.createComment({
- issue_number: context.issue.number,
- owner: context.repo.owner,
- repo: context.repo.repo,
- body: comment
- });
+ run: node build-tools/cli.js build -t all --no-sync
test:
name: Tests (SDK + Editor)
diff --git a/build-tools/track-bundle-size.js b/build-tools/track-bundle-size.js
deleted file mode 100644
index f440e6422..000000000
--- a/build-tools/track-bundle-size.js
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/usr/bin/env node
-
-import { readFile, writeFile, mkdir } from 'fs/promises';
-import { existsSync } from 'fs';
-import path from 'path';
-import config from './build.config.js';
-import * as logger from './utils/logger.js';
-
-const BASELINES_FILE = path.join(config.paths.root, '.github', 'bundle-size-baselines.json');
-const THRESHOLDS = {
- 'wasm/web/esengine.wasm': 900 * 1024,
- 'wasm/web/physics.wasm': 200 * 1024,
- 'wasm/web/spine42.wasm': 300 * 1024,
- 'wasm/web/spine38.wasm': 300 * 1024,
- 'wasm/web/spine41.wasm': 300 * 1024,
- 'wasm/wechat/esengine.wxgame.wasm': 4 * 1024 * 1024,
- 'wasm/wechat/esengine.wxgame.js': 512 * 1024,
- 'sdk/esm/esengine.js': 150 * 1024,
-};
-
-async function loadManifest() {
- const manifestPath = path.join(config.paths.output, 'manifest.json');
- if (!existsSync(manifestPath)) {
- logger.error('Manifest file not found. Run build with --manifest flag first.');
- process.exit(1);
- }
-
- const content = await readFile(manifestPath, 'utf-8');
- return JSON.parse(content);
-}
-
-async function loadBaselines() {
- if (!existsSync(BASELINES_FILE)) {
- return {};
- }
-
- const content = await readFile(BASELINES_FILE, 'utf-8');
- return JSON.parse(content);
-}
-
-async function saveBaselines(baselines) {
- await mkdir(path.dirname(BASELINES_FILE), { recursive: true });
- await writeFile(BASELINES_FILE, JSON.stringify(baselines, null, 2), 'utf-8');
-}
-
-function extractSizes(manifest) {
- const sizes = {};
-
- for (const target of manifest.targets) {
- for (const output of target.outputs) {
- sizes[output.path] = {
- size: output.size,
- sizeKB: output.sizeKB,
- sha256: output.sha256,
- };
- }
- }
-
- return sizes;
-}
-
-function compareSizes(current, baselines) {
- const results = [];
- let hasExceeded = false;
-
- for (const [filePath, data] of Object.entries(current)) {
- const baseline = baselines[filePath];
- const threshold = THRESHOLDS[filePath];
-
- const result = {
- path: filePath,
- current: data.size,
- currentKB: data.sizeKB,
- baseline: baseline?.size || null,
- baselineKB: baseline?.sizeKB || null,
- delta: baseline ? data.size - baseline.size : null,
- deltaKB: baseline ? data.sizeKB - baseline.sizeKB : null,
- deltaPercent: baseline ? ((data.size - baseline.size) / baseline.size * 100).toFixed(2) : null,
- threshold,
- thresholdKB: threshold ? Math.round(threshold / 1024) : null,
- exceeded: threshold ? data.size > threshold : false,
- };
-
- if (result.exceeded) {
- hasExceeded = true;
- }
-
- results.push(result);
- }
-
- return { results, hasExceeded };
-}
-
-function formatSizeChange(deltaKB) {
- if (deltaKB === null || deltaKB === 0) {
- return '';
- }
- const sign = deltaKB > 0 ? '+' : '';
- return ` (${sign}${deltaKB}KB)`;
-}
-
-function printReport(comparison, isCI = false) {
- const { results, hasExceeded } = comparison;
-
- logger.info('\n📦 Bundle Size Report:');
-
- for (const result of results) {
- const status = result.exceeded ? '❌' : '✓';
- const change = formatSizeChange(result.deltaKB);
- const percent = result.deltaPercent ? ` ${result.deltaPercent > 0 ? '+' : ''}${result.deltaPercent}%` : '';
-
- if (result.threshold) {
- logger.info(` ${status} ${result.path}: ${result.currentKB}KB / ${result.thresholdKB}KB${change}${percent}`);
- } else {
- logger.info(` ${status} ${result.path}: ${result.currentKB}KB${change}${percent}`);
- }
- }
-
- if (hasExceeded && isCI) {
- logger.error('\n⚠️ Bundle size thresholds exceeded!');
- return false;
- }
-
- logger.success('\n✓ Bundle sizes OK');
- return true;
-}
-
-function generatePRComment(comparison) {
- const { results } = comparison;
-
- let comment = '## 📦 Bundle Size Report\n\n';
- comment += '| File | Size | Baseline | Change | Threshold | Status |\n';
- comment += '|------|------|----------|--------|-----------|--------|\n';
-
- for (const result of results) {
- const size = `${result.currentKB}KB`;
- const baseline = result.baselineKB !== null ? `${result.baselineKB}KB` : 'N/A';
- const change = result.deltaKB !== null
- ? `${result.deltaKB > 0 ? '+' : ''}${result.deltaKB}KB (${result.deltaPercent}%)`
- : '-';
- const threshold = result.thresholdKB !== null ? `${result.thresholdKB}KB` : 'N/A';
- const status = result.exceeded ? '❌ Exceeded' : '✓ OK';
-
- comment += `| ${result.path} | ${size} | ${baseline} | ${change} | ${threshold} | ${status} |\n`;
- }
-
- return comment;
-}
-
-async function main() {
- const args = process.argv.slice(2);
- const mode = args[0] || 'check';
-
- const manifest = await loadManifest();
- const currentSizes = extractSizes(manifest);
- const baselines = await loadBaselines();
-
- if (mode === 'update') {
- await saveBaselines(currentSizes);
- logger.success('Bundle size baselines updated');
- return;
- }
-
- if (mode === 'check') {
- const comparison = compareSizes(currentSizes, baselines);
- const isCI = process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';
- const success = printReport(comparison, isCI);
-
- if (!success && isCI) {
- process.exit(1);
- }
- return;
- }
-
- if (mode === 'pr-comment') {
- const comparison = compareSizes(currentSizes, baselines);
- const comment = generatePRComment(comparison);
- console.log(comment);
- return;
- }
-
- logger.error(`Unknown mode: ${mode}. Use 'check', 'update', or 'pr-comment'.`);
- process.exit(1);
-}
-
-main().catch(err => {
- logger.error(err.message);
- process.exit(1);
-});