jquery/build/post-compile.js

21 lines
658 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
var print = require( "sys" ).print,
fs = require( "fs" ),
src = fs.readFileSync( process.argv[2], "utf8" ),
version = fs.readFileSync( "version.txt", "utf8" ),
// License Template
2011-07-25 17:23:14 +00:00
license = "/*! jQuery v@VERSION http://jquery.com/ | http://jquery.org/license */";
// Previously done in sed but reimplemented here due to portability issues
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 );
// Replace license block with minimal license
src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license );
print( src );