Skip to content

Commit 9630da3

Browse files
committed
fix release size check: lower threshold for pdf.sandbox (v6 made it smaller)
1 parent c9b37c9 commit 9630da3

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

build-tools/5-2-release-library-ci.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,26 @@ runCommand('node ./build-tools/1-build-base-library.js', 'Error 53: build-base-l
4949

5050
// Verify bleeding-edge assets were created
5151
const bleedingEdgePath = path.join('projects', 'ngx-extended-pdf-viewer', 'bleeding-edge');
52-
const minFileSize = 700 * 1024; // 700 KB in bytes
52+
53+
// Per-file-type minimum sizes. pdf.js 6.0 shrank the sandbox bundle considerably
54+
// (from ~1 MB in v5.x to ~140–340 KB), so the previous flat 700 KB threshold
55+
// would false-positive on legitimate v6 builds. Thresholds chosen ~25% below
56+
// observed v6 sizes to catch genuinely empty/broken builds without being brittle.
57+
function expectedMinSize(fileName) {
58+
if (fileName.includes('pdf.sandbox-')) {
59+
return fileName.endsWith('.min.mjs') ? 100 * 1024 : 250 * 1024;
60+
}
61+
// pdf.worker-* and viewer-* are always > 1 MB even minified.
62+
return 700 * 1024;
63+
}
5364

5465
function verifyFile(filePath, description) {
5566
if (!fs.existsSync(filePath)) {
5667
console.error(`Error: Missing file - ${description}: ${filePath}`);
5768
return false;
5869
}
5970
const stats = fs.statSync(filePath);
71+
const minFileSize = expectedMinSize(description);
6072
if (stats.size < minFileSize) {
6173
console.error(`Error: File too small (${stats.size} bytes, expected >= ${minFileSize}) - ${description}: ${filePath}`);
6274
return false;

0 commit comments

Comments
 (0)