Skip to content

Commit e2622da

Browse files
committed
build: round payload size for comparison
In some cases the payload is still showing up in the CI even if there was no change to the library. This seems to be because the file sizes are not rounded and can sometimes be not very exact. Resulting in numbers like: `material_fesm_2014": 1004.1319999999998`. To have a more readable output in the gulp task, the file sizes should be rounded. This also makes the diff comparsion in the Firebase function better.
1 parent 244c906 commit e2622da

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/gulp/tasks/payload.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ task('payload', ['material:clean-build'], async () => {
5555
}
5656
});
5757

58-
/** Returns the size of the given library bundle. */
58+
/** Returns the size of the given library bundle. Size is rounded to two decimals places. */
5959
function getBundleSize(bundleName: string) {
60-
return glob(bundleName, {cwd: bundlesDir})
60+
const fileSize = glob(bundleName, {cwd: bundlesDir})
6161
.reduce((sum, fileName) => sum + getFilesize(join(bundlesDir, fileName)), 0);
62+
63+
return Math.round(fileSize * 100) / 100;
6264
}
6365

6466
/** Returns the size of a file in kilobytes. */

0 commit comments

Comments
 (0)