2011-02-12 02:35:41 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2011-12-15 15:11:24 +00:00
|
|
|
var fs = require( "fs" ),
|
2011-07-23 21:53:53 +00:00
|
|
|
src = fs.readFileSync( process.argv[2], "utf8" ),
|
|
|
|
version = fs.readFileSync( "version.txt", "utf8" ),
|
|
|
|
// License Template
|
2011-10-22 20:06:57 +00:00
|
|
|
license = "/*! jQuery v@VERSION jquery.com | jquery.org/license */";
|
2011-07-23 21:53:53 +00:00
|
|
|
|
|
|
|
|
2011-02-12 02:35:41 +00:00
|
|
|
// Previously done in sed but reimplemented here due to portability issues
|
2011-07-23 21:53:53 +00:00
|
|
|
src = src.replace( /^(\s*\*\/)(.+)/m, "$1\n$2" ) + ";";
|
|
|
|
|
2011-07-25 17:23:14 +00:00
|
|
|
// Set minimal license block var
|
|
|
|
license = license.replace( "@VERSION", version );
|
2011-07-23 23:18:41 +00:00
|
|
|
|
2011-07-23 21:53:53 +00:00
|
|
|
// Replace license block with minimal license
|
|
|
|
src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license );
|
|
|
|
|
2011-12-15 15:11:24 +00:00
|
|
|
fs.writeFileSync( "dist/jquery.min.js", src, "utf8" );
|