angular/packages/zone.js/check-file-size.js
Joey Perrott 9dbe6fc18b refactor: update license text to point to angular.dev (#57901)
Update license text to point to angular.dev instead of angular.io

PR Close #57901
2024-09-24 15:33:00 +02:00

29 lines
797 B
JavaScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
const fs = require('fs');
module.exports = function (config) {
let chkResult = true;
config.targets.forEach((target) => {
if (target.checkTarget) {
try {
const stats = fs.statSync(target.path);
if (stats.size > target.limit) {
console.error(
`file ${target.path} size over limit, limit is ${target.limit}, actual is ${stats.size}`,
);
chkResult = false;
}
} catch (err) {
console.error(`failed to get filesize: ${target.path}`);
chkResult = false;
}
}
});
return chkResult;
};