diff --git a/build.js b/build.js index 106c510ab..f7153b7a6 100755 --- a/build.js +++ b/build.js @@ -18,6 +18,9 @@ /** Shortcut used to push arrays of values to an array */ var push = arrayRef.push; + /** Used to detect the Node.js executable in command-line arguments */ + var reNode = /(?:^|[\/\\])node(?:\.exe)?$/; + /** Shortcut used to convert array-like objects to arrays */ var slice = arrayRef.slice; @@ -431,7 +434,7 @@ function addCommandsToHeader(source, commands) { return source.replace(/(\/\**\n)( \*)( *@license[\s*]+)( *Lo-Dash [\w.-]+)(.*)/, function() { // remove `node path/to/build.js` from `commands` - if (commands[0] == 'node') { + if (reNode.test(commands[0])) { commands.splice(0, 2); } // add quotes to commands with spaces or equals signs @@ -1369,7 +1372,7 @@ var sourceMapURL; // used to report invalid command-line arguments - var invalidArgs = _.reject(options.slice(options[0] == 'node' ? 2 : 0), function(value, index, options) { + var invalidArgs = _.reject(options.slice(reNode.test(options[0]) ? 2 : 0), function(value, index, options) { if (/^(?:-o|--output)$/.test(options[index - 1]) || /^(?:category|exclude|exports|iife|include|moduleId|minus|plus|settings|template)=.*$/.test(value)) { return true; diff --git a/build/minify.js b/build/minify.js index 365bd18d9..798e3a4d6 100755 --- a/build/minify.js +++ b/build/minify.js @@ -2,7 +2,7 @@ ;(function() { 'use strict'; - /** Load Node modules */ + /** Load modules */ var fs = require('fs'), https = require('https'), path = require('path'), @@ -39,6 +39,9 @@ /** The media type for raw blob data */ var mediaType = 'application/vnd.github.v3.raw'; + /** Used to detect the Node.js executable in command-line arguments */ + var reNode = /(?:^|[\/\\])node(?:\.exe)?$/; + /** Used to reference parts of the blob href */ var location = (function() { var host = 'api.github.com', @@ -59,7 +62,7 @@ 'advanced': 'ADVANCED_OPTIMIZATIONS' }; - /** Reassign `existsSync` for older versions of Node */ + /** Reassign `existsSync` for older versions of Node.js */ fs.existsSync || (fs.existsSync = path.existsSync); /*--------------------------------------------------------------------------*/ @@ -96,7 +99,7 @@ options = source; // used to report invalid command-line arguments - var invalidArgs = _.reject(options.slice(options[0] == 'node' ? 2 : 0), function(value, index, options) { + var invalidArgs = _.reject(options.slice(reNode.test(options[0]) ? 2 : 0), function(value, index, options) { if (/^(?:-o|--output)$/.test(options[index - 1]) || /^modes=.*$/.test(value)) { return true; diff --git a/build/post-compile.js b/build/post-compile.js index db56866f8..85cb8053f 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -2,7 +2,7 @@ ;(function() { 'use strict'; - /** The Node filesystem module */ + /** The Node.js filesystem module */ var fs = require('fs'); /** The minimal license/copyright template */ diff --git a/build/pre-compile.js b/build/pre-compile.js index f7aa3d2d6..cb3613a44 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -2,7 +2,7 @@ ;(function() { 'use strict'; - /** The Node filesystem module */ + /** The Node.js filesystem module */ var fs = require('fs'); /** Used to minify variables embedded in compiled strings */