diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config/pacote.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/config/pacote.js b/lib/config/pacote.js index 530e33512..620a8b714 100644 --- a/lib/config/pacote.js +++ b/lib/config/pacote.js @@ -48,10 +48,21 @@ function pacoteOpts (moreOpts) { } npm.config.keys.forEach(function (k) { - if (k[0] === '/' && k.match(/.*:_authToken$/)) { + const authMatch = k[0] === '/' && k.match( + /(.*):(_authToken|username|_password|password|email|alwaysAuth)$/ + ) + if (authMatch) { + const nerfDart = authMatch[1] + const key = authMatch[2] + const val = npm.config.get(k) if (!opts.auth) { opts.auth = {} } - opts.auth[k.replace(/:_authToken$/, '')] = { - token: npm.config.get(k) + if (!opts.auth[nerfDart]) { opts.auth[nerfDart] = {} } + if (key === '_authToken') { + opts.auth[nerfDart].token = val + } else if (key.match(/password$/i)) { + opts.auth[nerfDart].password = val + } else { + opts.auth[nerfDart][key] = val } } if (k[0] === '@') { |