Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
fallback to var in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
James Baxley committed Oct 8, 2016
1 parent 180d4d6 commit 6baf0fd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/filesize.js
Original file line number Diff line number Diff line change
@@ -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'),
Expand All @@ -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');
Expand All @@ -29,15 +29,15 @@ 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)}.`));
}
}

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)}.`));
Expand Down

0 comments on commit 6baf0fd

Please sign in to comment.