diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2011-07-23 17:53:53 -0400 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2011-07-23 17:58:08 -0400 |
commit | 8a610073f906916eb77399d83acd9cf6095f7db6 (patch) | |
tree | 1445e91030ca22fc0ed399e4bb31f4df9472e8af /build | |
parent | 27291ff06ddb655f90a8d1eada71f7ac61499b12 (diff) | |
download | jquery-8a610073f906916eb77399d83acd9cf6095f7db6.tar.gz jquery-8a610073f906916eb77399d83acd9cf6095f7db6.zip |
Builds minimal license header block for jquery.min.js
Diffstat (limited to 'build')
-rw-r--r-- | build/post-compile.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/build/post-compile.js b/build/post-compile.js index 1bbeaa6f4..ea93c50ff 100644 --- a/build/post-compile.js +++ b/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 ); |