Skip to content

Commit

Permalink
Reformat jshint errors to be readable; make post-compile.js write dir…
Browse files Browse the repository at this point in the history
…ectly to jquery.min.js; update required Node version
  • Loading branch information
rwaldron authored and timmywil committed Dec 15, 2011
1 parent 4534db1 commit f724bc6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -97,7 +97,7 @@ ${JQ_MIN}: ${JQ}
@@if test ! -z ${JS_ENGINE}; then \ @@if test ! -z ${JS_ENGINE}; then \
echo "Minifying jQuery" ${JQ_MIN}; \ echo "Minifying jQuery" ${JQ_MIN}; \
${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \ ${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
${POST_COMPILER} ${JQ_MIN}.tmp > ${JQ_MIN}; \ ${POST_COMPILER} ${JQ_MIN}.tmp; \
rm -f ${JQ_MIN}.tmp; \ rm -f ${JQ_MIN}.tmp; \
else \ else \
echo "You must have NodeJS installed in order to minify jQuery."; \ echo "You must have NodeJS installed in order to minify jQuery."; \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -15,7 +15,7 @@ In the spirit of open source software development, jQuery always encourages comm
What you need to build your own jQuery What you need to build your own jQuery
-------------------------------------- --------------------------------------


In order to build jQuery, you need to have GNU make 3.8 or later, Node.js 0.2 or later, and git 1.7 or later. In order to build jQuery, you need to have GNU make 3.8 or later, Node.js 0.4.12 or later, and git 1.7 or later.
(Earlier versions might work OK, but are not tested.) (Earlier versions might work OK, but are not tested.)


Windows users have two options: Windows users have two options:
Expand Down
58 changes: 30 additions & 28 deletions build/jshint-check.js
@@ -1,34 +1,36 @@
var JSHINT = require("./lib/jshint").JSHINT, var jshint = require("./lib/jshint").JSHINT,
print = require("sys").print, src = require("fs").readFileSync("dist/jquery.js", "utf8"),
src = require("fs").readFileSync("dist/jquery.js", "utf8"); config = {
evil: true,
undef: false,
browser: true,
wsh: true,
eqnull: true,
expr: true,
curly: true,
trailing: true,
predef: [
"define",
"DOMParser"
],
maxerr: 100
};


JSHINT(src, { if ( jshint( src, config ) ) {
evil: true, console.log("JSHint check passed.");
undef: false, } else {
browser: true,
wsh: true,
eqnull: true,
expr: true,
curly: true,
trailing: true,
predef: [
"define",
"DOMParser"
],
maxerr: 100
});


var e = JSHINT.errors, found = e.length, i = 0, w; console.log( "JSHint found errors." );


for ( ; i < e.length; i++ ) { jshint.errors.forEach(function( e ) {
w = e[i]; if ( !e ) { return; }


print( "\n" + w.evidence + "\n" ); var str = e.evidence ? e.evidence : "";
print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );
}


if ( found > 0 ) { if ( str ) {
print( "\n" + found + " Error(s) found.\n" ); str = str.replace( /\t/g, " " ).trim();
} else {
print( "JSHint check passed.\n" ); console.log( " [L" + e.line + ":C" + e.character + "] " + e.reason + "\n " + str + "\n");
}
});
} }
5 changes: 2 additions & 3 deletions build/post-compile.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node


var print = require( "sys" ).print, var fs = require( "fs" ),
fs = require( "fs" ),
src = fs.readFileSync( process.argv[2], "utf8" ), src = fs.readFileSync( process.argv[2], "utf8" ),
version = fs.readFileSync( "version.txt", "utf8" ), version = fs.readFileSync( "version.txt", "utf8" ),
// License Template // License Template
Expand All @@ -17,4 +16,4 @@ license = license.replace( "@VERSION", version );
// Replace license block with minimal license // Replace license block with minimal license
src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license ); src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license );


print( src ); fs.writeFileSync( "dist/jquery.min.js", src, "utf8" );

0 comments on commit f724bc6

Please sign in to comment.