diff --git a/scripts/filesize.js b/scripts/filesize.js index ee9d3acca6..627a99f951 100755 --- a/scripts/filesize.js +++ b/scripts/filesize.js @@ -1,7 +1,7 @@ #!/usr/bin/env node 'use strict'; -const Flags = require('minimist')(process.argv.slice(2)), +var Flags = require('minimist')(process.argv.slice(2)), Fs = require('fs'), Path = require('path'), GzipSize = require('gzip-size'), @@ -16,9 +16,9 @@ let totalSize = 0, totalGzippedSize = 0, filePath = Path.resolve(process.cwd(), Flags.file); -const rawSize = Fs.statSync(filePath).size; +var rawSize = Fs.statSync(filePath).size; totalSize = PrettyBytes(rawSize); -const rawGzippedSize = GzipSize.sync(Fs.readFileSync(filePath, 'utf8')); +var rawGzippedSize = GzipSize.sync(Fs.readFileSync(filePath, 'utf8')); totalGzippedSize = PrettyBytes(rawGzippedSize); console.log('\n'); @@ -29,7 +29,7 @@ console.log('=================================================================== console.log('\n'); if (Flags.max) { - const max = Number(Flags.max) * 1000; // kb to bytes + var max = Number(Flags.max) * 1000; // kb to bytes if (max > totalSize) { process.exitCode = 1; console.log(Colors.red(`The total size of ${Path.basename(filePath)} exceeds ${PrettyBytes(max)}.`)); @@ -37,7 +37,7 @@ if (Flags.max) { } if (Flags.maxGzip) { - const maxGzip = Number(Flags.maxGzip) * 1000; // kb to bytes + var maxGzip = Number(Flags.maxGzip) * 1000; // kb to bytes if (rawGzippedSize > maxGzip) { process.exitCode = 1; console.log(Colors.red(`The total gzipped size of ${Path.basename(filePath)} exceeds ${PrettyBytes(maxGzip)}.`));