diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2011-08-04 14:16:35 -0700 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2011-08-04 14:16:35 -0700 |
commit | 566f958d58e7f5dfeda5e31d7531c7d535a6a9e9 (patch) | |
tree | 913e17ffe8ec937a48bb099cc1176a3859854f98 | |
parent | ea0303ecbf8e6b8a5c39bbad463e3e0d1dc84543 (diff) | |
parent | 68f1f4d54516a400ec9aa70eab50e7891032ffba (diff) | |
download | jquery-566f958d58e7f5dfeda5e31d7531c7d535a6a9e9.tar.gz jquery-566f958d58e7f5dfeda5e31d7531c7d535a6a9e9.zip |
Merge pull request #443 from rwldrn/minimal-license
Builds minimal license header block for jquery.min.js
-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..98b8b849f 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 http://jquery.com/ | http://jquery.org/license */"; + // 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" ) + ";"; + +// 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 ); |