diff options
author | isaacs <nope@not.real> | 2019-07-03 10:23:19 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-18 15:12:49 -0700 |
commit | 1721034a40c5e7a0a334701dc36153adee3f27e5 (patch) | |
tree | 7b2ce5a0c5d67d2e1d817fc548571250e8c1a305 /deps/npm/lib | |
parent | 6df7b6a4f9cb64d298e7fd0691c4d09679872922 (diff) | |
download | android-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.tar.gz android-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.tar.bz2 android-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.zip |
deps: upgrade npm to 6.10.0
PR-URL: https://github.com/nodejs/node/pull/28525
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'deps/npm/lib')
-rw-r--r-- | deps/npm/lib/adduser.js | 21 | ||||
-rw-r--r-- | deps/npm/lib/audit.js | 4 | ||||
-rw-r--r-- | deps/npm/lib/outdated.js | 11 | ||||
-rw-r--r-- | deps/npm/lib/token.js | 23 | ||||
-rw-r--r-- | deps/npm/lib/unbuild.js | 4 | ||||
-rw-r--r-- | deps/npm/lib/unpublish.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/utils/unsupported.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/version.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/view.js | 1 |
9 files changed, 35 insertions, 35 deletions
diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js index e1c2210325..cf82ff5b04 100644 --- a/deps/npm/lib/adduser.js +++ b/deps/npm/lib/adduser.js @@ -1,9 +1,9 @@ module.exports = adduser -var log = require('npmlog') -var npm = require('./npm.js') -var usage = require('./utils/usage') -var crypto +const log = require('npmlog') +const npm = require('./npm.js') +const usage = require('./utils/usage') +let crypto try { crypto = require('crypto') @@ -21,20 +21,21 @@ function adduser (args, cb) { )) } - var registry = npm.config.get('registry') - var scope = npm.config.get('scope') - var creds = npm.config.getCredentialsByURI(npm.config.get('registry')) + let registry = npm.config.get('registry') + const scope = npm.config.get('scope') + const creds = npm.config.getCredentialsByURI(npm.config.get('registry')) if (scope) { - var scopedRegistry = npm.config.get(scope + ':registry') - var cliRegistry = npm.config.get('registry', 'cli') + const scopedRegistry = npm.config.get(scope + ':registry') + const cliRegistry = npm.config.get('registry', 'cli') if (scopedRegistry && !cliRegistry) registry = scopedRegistry } log.disableProgress() + let auth try { - var auth = require('./auth/' + npm.config.get('auth-type')) + auth = require('./auth/' + npm.config.get('auth-type')) } catch (e) { return cb(new Error('no such auth module')) } diff --git a/deps/npm/lib/audit.js b/deps/npm/lib/audit.js index 2cabef9d27..37b54d6eca 100644 --- a/deps/npm/lib/audit.js +++ b/deps/npm/lib/audit.js @@ -39,7 +39,7 @@ module.exports = auditCmd const usage = require('./utils/usage') auditCmd.usage = usage( 'audit', - '\nnpm audit [--json]' + + '\nnpm audit [--json] [--production]' + '\nnpm audit fix ' + '[--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]' ) @@ -175,7 +175,7 @@ function auditCmd (args, cb) { const requires = Object.assign( {}, (pkgJson && pkgJson.dependencies) || {}, - (pkgJson && pkgJson.devDependencies) || {} + (!opts.production && pkgJson && pkgJson.devDependencies) || {} ) return lockVerify(npm.prefix).then((result) => { if (result.status) return audit.generate(sw, requires) diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index 197b719625..bb4c346f9a 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -101,7 +101,10 @@ function outdated (args, silent, cb) { return aa[0].path.localeCompare(bb[0].path) || aa[1].localeCompare(bb[1]) }) - if (er || silent || list.length === 0) return cb(er, list) + if (er || silent || + (list.length === 0 && !opts.json)) { + return cb(er, list) + } if (opts.json) { output(makeJSON(list, opts)) } else if (opts.parseable) { @@ -129,7 +132,7 @@ function outdated (args, silent, cb) { } output(table(outTable, tableOpts)) } - process.exitCode = 1 + process.exitCode = list.length ? 1 : 0 cb(null, list.map(function (item) { return [item[0].parent.path].concat(item.slice(1, 7)) })) }) })) @@ -149,7 +152,7 @@ function makePretty (p, opts) { has || 'MISSING', want, latest, - deppath + deppath || 'global' ] if (long) { columns[5] = type @@ -366,6 +369,8 @@ function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, opts, cb, type return doIt('git', 'git') } else if (parsed.type === 'file') { return updateLocalDeps() + } else if (parsed.type === 'remote') { + return doIt('remote', 'remote') } else { return packument(parsed, opts.concat({ 'prefer-online': true diff --git a/deps/npm/lib/token.js b/deps/npm/lib/token.js index 326f98ec7e..9b1fbef9ce 100644 --- a/deps/npm/lib/token.js +++ b/deps/npm/lib/token.js @@ -5,6 +5,7 @@ const npm = require('./npm.js') const figgyPudding = require('figgy-pudding') const npmConfig = require('./config/figgy-config.js') const output = require('./utils/output.js') +const otplease = require('./utils/otplease.js') const Table = require('cli-table3') const Bluebird = require('bluebird') const isCidrV4 = require('is-cidr').v4 @@ -80,6 +81,7 @@ function generateTokenIds (tokens, minLength) { } const TokenConfig = figgyPudding({ + auth: {}, registry: {}, otp: {}, cidr: {}, @@ -185,13 +187,8 @@ function rm (args) { } }) return Bluebird.map(toRemove, (key) => { - return profile.removeToken(key, conf).catch((ex) => { - if (ex.code !== 'EOTP') throw ex - log.info('token', 'failed because revoking this token requires OTP') - return readUserInfo.otp().then((otp) => { - conf.auth.otp = otp - return profile.removeToken(key, conf) - }) + return otplease(conf, conf => { + return profile.removeToken(key, conf) }) }) })).then(() => { @@ -213,15 +210,9 @@ function create (args) { const validCIDR = validateCIDRList(cidr) return readUserInfo.password().then((password) => { log.info('token', 'creating') - return profile.createToken(password, readonly, validCIDR, conf).catch((ex) => { - if (ex.code !== 'EOTP') throw ex - log.info('token', 'failed because it requires OTP') - return readUserInfo.otp().then((otp) => { - conf.auth.otp = otp - log.info('token', 'creating with OTP') - return pulseTillDone.withPromise(profile.createToken(password, readonly, validCIDR, conf)) - }) - }) + return pulseTillDone.withPromise(otplease(conf, conf => { + return profile.createToken(password, readonly, validCIDR, conf) + })) }).then((result) => { delete result.key delete result.updated diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js index d527778e92..3e115b6999 100644 --- a/deps/npm/lib/unbuild.js +++ b/deps/npm/lib/unbuild.js @@ -58,7 +58,9 @@ function rmStuff (pkg, folder, cb) { // if it's global, and folder is in {prefix}/node_modules, // then bins are in {prefix}/bin // otherwise, then bins are in folder/../.bin - var parent = pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder) + var dir = path.dirname(folder) + var scope = path.basename(dir) + var parent = scope.charAt(0) === '@' ? path.dirname(dir) : dir var gnm = npm.dir // gnm might be an absolute path, parent might be relative // this checks they're the same directory regardless diff --git a/deps/npm/lib/unpublish.js b/deps/npm/lib/unpublish.js index bf5867a268..203c8b592f 100644 --- a/deps/npm/lib/unpublish.js +++ b/deps/npm/lib/unpublish.js @@ -99,7 +99,7 @@ function unpublish (args, cb) { }).then( ret => { if (!opts.silent && opts.loglevel !== 'silent') { - output(`-${spec.name}${ + output(`- ${spec.name}${ spec.type === 'version' ? `@${spec.rawSpec}` : '' }`) } diff --git a/deps/npm/lib/utils/unsupported.js b/deps/npm/lib/utils/unsupported.js index bfed5cdbea..20cee157ee 100644 --- a/deps/npm/lib/utils/unsupported.js +++ b/deps/npm/lib/utils/unsupported.js @@ -8,7 +8,7 @@ var supportedNode = [ {ver: '11', min: '11.0.0'}, {ver: '12', min: '12.0.0'} ] -var knownBroken = '<4.7.0' +var knownBroken = '<6.0.0' var checkVersion = exports.checkVersion = function (version) { var versionNoPrerelease = version.replace(/-.*$/, '') diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js index 265b049bf3..0f1e97aedd 100644 --- a/deps/npm/lib/version.js +++ b/deps/npm/lib/version.js @@ -301,7 +301,7 @@ function _commit (version, localData, cb) { ...(signCommit ? ['-S', '-m'] : ['-m']), message ]) - const flagForTag = signTag ? '-sm' : '-am' + const flagForTag = signTag ? '-sm' : '-m' stagePackageFiles(localData, options).then(() => { return git.exec(commitArgs, options) diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js index fc10a2f4ac..a16884e25f 100644 --- a/deps/npm/lib/view.js +++ b/deps/npm/lib/view.js @@ -185,6 +185,7 @@ function fetchAndRead (nv, args, silent, opts, cb) { } if (silent) { + return retval } else if (error) { throw error } else if ( |