aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Frang <gnarf@gnarf.net>2011-10-17 15:32:01 -0500
committerCorey Frang <gnarf@gnarf.net>2011-10-17 15:32:01 -0500
commitf6c12849f1018f928c933ce63e4aceea6290a191 (patch)
tree5dde1e482d2f39fdda2eb0614b4956ad35028a82
parentd2764d88ca1a11e9745727fd7c2f7f239e03e95f (diff)
downloadjquery-ui-f6c12849f1018f928c933ce63e4aceea6290a191.tar.gz
jquery-ui-f6c12849f1018f928c933ce63e4aceea6290a191.zip
Build: Fixing the sizer script to handle this many files
-rw-r--r--build/build/sizer.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/build/build/sizer.js b/build/build/sizer.js
index 3c3e4c428..a4afb44af 100644
--- a/build/build/sizer.js
+++ b/build/build/sizer.js
@@ -2,7 +2,8 @@ var fs = require( "fs" ),
stdin = process.openStdin(),
rsize = /(\d+).*?(jquery\S+)/g,
oldsizes = {},
- sizes = {};
+ sizes = {},
+ input = "";
try {
oldsizes = JSON.parse( fs.readFileSync( __dirname + "/.sizecache.json", "utf8" ) );
@@ -10,26 +11,27 @@ try {
oldsizes = {};
};
+function lpad( str, len, chr ) {
+ return ( Array(len+1).join( chr || " ") + str ).substr( -len );
+}
+
stdin.on( "data" , function( chunk ) {
+ input += chunk;
+});
+stdin.on( "end", function() {
var match;
- while ( match = rsize.exec( chunk ) ) {
+ while ( match = rsize.exec( input ) ) {
sizes[ match[2] ] = parseInt( match[1], 10 );
}
-});
-
-function lpad( str, len, chr ) {
- return ( Array(len+1).join( chr || " ") + str ).substr( -len );
-}
-stdin.on( "end", function() {
fs.writeFileSync( __dirname + "/.sizecache.json", JSON.stringify( sizes, true ), "utf8" );
for ( var key in sizes ) {
var diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] );
if ( diff > 0 ) {
diff = "+" + diff;
}
- console.log( "%s %s %s", lpad( sizes[ key ], 8 ), lpad( diff ? "(" + diff + ")" : "(-)", 8 ), key );
+ console.log( "%s %s %s", lpad( sizes[ key ], 8 ), lpad( oldsizes[key] ? "(" + diff + ")" : "(-)", 8 ), key );
}
process.exit();
}); \ No newline at end of file