Use @license in the copyright/license header. [closes #138]

Former-commit-id: 3b924dad24d56e0fd33e4df1341b09c6165521a1
This commit is contained in:
John-David Dalton
2012-12-22 14:51:28 -06:00
parent bd8f882c94
commit bda4747e9c
12 changed files with 307 additions and 320 deletions

View File

@@ -420,12 +420,7 @@
* @returns {String} Returns the modified source.
*/
function addCommandsToHeader(source, commands) {
return source.replace(/(\/\*!\n)( \*)?( *Lo-Dash [\w.-]+)(.*)/, function() {
// convert unmatched groups to empty strings
var parts = _.map(slice.call(arguments, 1), function(part) {
return part || '';
});
return source.replace(/(\/\**\n)( \*)( *@license[\s*]+)( *Lo-Dash [\w.-]+)(.*)/, function() {
// remove `node path/to/build.js` from `commands`
if (commands[0] == 'node') {
commands.splice(0, 2);
@@ -440,9 +435,11 @@
return command;
});
// add build commands to copyright/license header
var parts = slice.call(arguments, 1);
return (
parts[0] +
parts[1] + parts[2] + ' (Custom Build)' + parts[3] + '\n' +
parts[1] +
parts[2] + parts[3] + ' (Custom Build)' + parts[4] + '\n' +
parts[1] + ' Build: `lodash ' + commands.join(' ') + '`'
);
});
@@ -1944,7 +1941,7 @@
var token = '%output%',
index = iife.indexOf(token);
source = source.match(/\/\*![\s\S]+?\*\/\n/) +
source = source.match(/^\/\**[\s\S]+?\*\/\n/) +
iife.slice(0, index) +
source.replace(/^[\s\S]+?\(function[^{]+?{|}\(this\)\)[;\s]*$/g, '') +
iife.slice(index + token.length);