Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #443 from rwldrn/minimal-license
Builds minimal license header block for jquery.min.js
- Loading branch information
Showing
1 changed file
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ); |