|
3 | 3 | ESP3D-WEBUI release bundle sizes report. |
4 | 4 |
|
5 | 5 | 1. Runs `npm run buildall` (builds all targets/subtargets). |
6 | | -2. Scans dist/ for index.html.gz (and any other artifacts) and collects sizes. |
7 | | -3. Writes a Markdown document with a table: target, subtarget, size (bytes + human), path. |
| 6 | +2. Scans dist/ for index.html.gz, index.html.br (and any other artifacts) and collects sizes. |
| 7 | +3. Writes a Markdown document with a table: target, subtarget, gzip path/size, brotli path/size. |
8 | 8 |
|
9 | 9 | Usage: |
10 | 10 | python tools/release_bundle_sizes.py |
@@ -108,26 +108,36 @@ def main() -> int: |
108 | 108 | "", |
109 | 109 | "Generated by `tools/release_bundle_sizes.py`. Use this table in RELEASE_*.md or docs/FEATURES_AND_BUNDLE.md.", |
110 | 110 | "", |
111 | | - "| Target | Subtarget | Size | Bytes | Path |", |
112 | | - "|--------|-----------|------|-------|------|", |
| 111 | + "| Target | Subtarget | Gzip Path | Gzip Size | Brotli Path | Brotli Size |", |
| 112 | + "|--------|-----------|-----------|-----------|-------------|-------------|", |
113 | 113 | ] |
114 | 114 |
|
115 | | - total_bytes = 0 |
| 115 | + total_gz = 0 |
| 116 | + total_br = 0 |
116 | 117 | for (target, subtarget), files in sorted(by_package.items()): |
117 | | - # Primary artifact is usually index.html.gz |
118 | | - files_sorted = sorted(files, key=lambda x: (-x[0], x[1])) |
119 | | - total_package = sum(s for s, _ in files) |
120 | | - total_bytes += total_package |
121 | | - primary = files_sorted[0] |
122 | | - size_str = human_size(primary[0]) |
123 | | - paths_str = "; ".join(rel for _, rel in files_sorted[:3]) |
124 | | - if len(files_sorted) > 3: |
125 | | - paths_str += f" (+{len(files_sorted) - 3} more)" |
126 | | - lines.append(f"| {target} | {subtarget} | {size_str} | {primary[0]} | {paths_str} |") |
| 118 | + gz_size = 0 |
| 119 | + br_size = 0 |
| 120 | + gz_path = None |
| 121 | + br_path = None |
| 122 | + for size, rel in files: |
| 123 | + if rel.endswith('.gz'): |
| 124 | + gz_size = size |
| 125 | + gz_path = rel |
| 126 | + total_gz += size |
| 127 | + elif rel.endswith('.br'): |
| 128 | + br_size = size |
| 129 | + br_path = rel |
| 130 | + total_br += size |
| 131 | + gz_str = human_size(gz_size) if gz_size else 'N/A' |
| 132 | + br_str = human_size(br_size) if br_size else 'N/A' |
| 133 | + gz_path_str = gz_path if gz_path else 'N/A' |
| 134 | + br_path_str = br_path if br_path else 'N/A' |
| 135 | + lines.append(f"| {target} | {subtarget} | {gz_path_str} | {gz_str} | {br_path_str} | {br_str} |") |
127 | 136 |
|
128 | 137 | lines.extend([ |
129 | 138 | "", |
130 | | - f"**Total size (all packages):** {human_size(total_bytes)} ({total_bytes} bytes).", |
| 139 | + f"**Total Gzip size:** {human_size(total_gz)} ({total_gz} bytes).", |
| 140 | + f"**Total Brotli size:** {human_size(total_br)} ({total_br} bytes).", |
131 | 141 | "", |
132 | 142 | ]) |
133 | 143 |
|
|
0 commit comments