Skip to content

Commit

Permalink
fix: Remove duplicate environment variables allow to start from npm s…
Browse files Browse the repository at this point in the history
…cripts
  • Loading branch information
nobitagamer committed Jun 15, 2016
1 parent b53abf9 commit 04044f6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ function normalizeOptions(options) {
var newPath = pathToBin + path.delimiter + process.env[pathName]
options.env = _.extend(process.env, _.fromPairs([[pathName, newPath]]), options.env)

return options
// HACK: remove duplicate environment variables when start from npm scripts.
options.env = _.pickBy(options, function (value, key) {
return !_.startsWith(_.lowerCase(key), 'npm_')
});

return options;
}

function runCommands(commands, options, file, done) {
async.eachSeries(commands, function (command, done) {
var context = _.extend({file: file}, options.templateData)
var context = _.extend({ file: file }, options.templateData)
command = gutil.template(command, context)

if (options.verbose) {
Expand Down

0 comments on commit 04044f6

Please sign in to comment.