Improve code formatting and readability in build verification script

This commit is contained in:
2026-01-29 13:50:37 +00:00
parent d2e03b1d62
commit 098c9e30fd

View File

@@ -41,7 +41,9 @@ for (const file of REQUIRED_FILES) {
if (exists) { if (exists) {
const stats = fs.statSync(filePath); const stats = fs.statSync(filePath);
const isDir = stats.isDirectory(); const isDir = stats.isDirectory();
console.log(`${file} ${isDir ? '(directory)' : `(${(stats.size / 1024).toFixed(2)} KB)`}`); console.log(
`${file} ${isDir ? '(directory)' : `(${(stats.size / 1024).toFixed(2)} KB)`}`
);
} else { } else {
errors.push(`Required file missing: ${file}`); errors.push(`Required file missing: ${file}`);
console.log(`${file} - MISSING`); console.log(`${file} - MISSING`);
@@ -67,14 +69,18 @@ if (fs.existsSync(assetsDir)) {
const stats = fs.statSync(path.join(assetsDir, file)); const stats = fs.statSync(path.join(assetsDir, file));
return total + stats.size; return total + stats.size;
}, 0); }, 0);
console.log(` Total JS size: ${(totalJsSize / 1024 / 1024).toFixed(2)} MB`); console.log(
` Total JS size: ${(totalJsSize / 1024 / 1024).toFixed(2)} MB`
);
// Warn if bundles are too large // Warn if bundles are too large
jsFiles.forEach(file => { jsFiles.forEach(file => {
const stats = fs.statSync(path.join(assetsDir, file)); const stats = fs.statSync(path.join(assetsDir, file));
const sizeMB = stats.size / 1024 / 1024; const sizeMB = stats.size / 1024 / 1024;
if (sizeMB > 1) { if (sizeMB > 1) {
warnings.push(`Large bundle detected: ${file} (${sizeMB.toFixed(2)} MB)`); warnings.push(
`Large bundle detected: ${file} (${sizeMB.toFixed(2)} MB)`
);
} }
}); });
} }