From 8a610073f906916eb77399d83acd9cf6095f7db6 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Sat, 23 Jul 2011 17:53:53 -0400 Subject: Builds minimal license header block for jquery.min.js --- build/post-compile.js | 19 ++++++++++++++++--- 1 file 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 ); -- cgit v1.2.3 From 7a1e8809632be7fb04b8e2fe4061bd47bb2ec485 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Sat, 23 Jul 2011 19:18:41 -0400 Subject: Mine and munge date from full source license header --- build/post-compile.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/build/post-compile.js b/build/post-compile.js index ea93c50ff..965bad28e 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -5,15 +5,26 @@ var print = require( "sys" ).print, 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 = "/*! jQuery v@VERSION @DATE http://jquery.com/ | http://jquery.org/license */", + date; -license = license.replace( "@VERSION", version ) - .replace( "@DATE", (new Date()).toLocaleString() ); - // Previously done in sed but reimplemented here due to portability issues src = src.replace( /^(\s*\*\/)(.+)/m, "$1\n$2" ) + ";"; +// Mine & Munge Date information +src.split( "\n" ).forEach(function( line, idx ) { + var data = line.split( " * Date: " ); + + if ( data.length && data[ 1 ] ) { + date = data[ 1 ]; + } +}); + +// Set minimal license block vars +license = license.replace( "@VERSION", version ) + .replace( "@DATE", date ); + // Replace license block with minimal license src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license ); -- cgit v1.2.3 From 68f1f4d54516a400ec9aa70eab50e7891032ffba Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 25 Jul 2011 13:23:14 -0400 Subject: Removes date from minimal license --- build/post-compile.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/build/post-compile.js b/build/post-compile.js index 965bad28e..98b8b849f 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -5,25 +5,14 @@ var print = require( "sys" ).print, 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 */", - date; + 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" ) + ";"; -// Mine & Munge Date information -src.split( "\n" ).forEach(function( line, idx ) { - var data = line.split( " * Date: " ); - - if ( data.length && data[ 1 ] ) { - date = data[ 1 ]; - } -}); - -// Set minimal license block vars -license = license.replace( "@VERSION", version ) - .replace( "@DATE", date ); +// 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 ); -- cgit v1.2.3