Skip to content
Permalink
Browse files

Builds minimal license header block for jquery.min.js

  • Loading branch information...
rwaldron committed Jul 23, 2011
1 parent 27291ff commit 8a610073f906916eb77399d83acd9cf6095f7db6
Showing with 16 additions and 3 deletions.
  1. +16 −3 build/post-compile.js
@@ -1,7 +1,20 @@
#!/usr/bin/env node

var print = require("sys").print,
src = require("fs").readFileSync(process.argv[2], "utf8");
var print = require( "sys" ).print,
fs = require( "fs" ),
src = fs.readFileSync( process.argv[2], "utf8" ),
version = fs.readFileSync( "version.txt", "utf8" ),
// License Template
license = "/*! jQuery v@VERSION @DATE http://jquery.com/ | http://jquery.org/license */";


license = license.replace( "@VERSION", version )
.replace( "@DATE", (new Date()).toLocaleString() );

// Previously done in sed but reimplemented here due to portability issues
print( src.replace( /^(\s*\*\/)(.+)/m, "$1\n$2" ) + ";" );
src = src.replace( /^(\s*\*\/)(.+)/m, "$1\n$2" ) + ";";

// Replace license block with minimal license
src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license );

print( src );

0 comments on commit 8a61007

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.