diff options
Diffstat (limited to 'deps/npm/lib/config')
-rw-r--r-- | deps/npm/lib/config/cmd-list.js | 115 | ||||
-rw-r--r-- | deps/npm/lib/config/defaults.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/config/get-credentials-by-uri.js | 15 |
3 files changed, 125 insertions, 7 deletions
diff --git a/deps/npm/lib/config/cmd-list.js b/deps/npm/lib/config/cmd-list.js new file mode 100644 index 0000000000..82725221ba --- /dev/null +++ b/deps/npm/lib/config/cmd-list.js @@ -0,0 +1,115 @@ +var extend = Object.assign || require('util')._extend + +// short names for common things +var shorthands = { + 'un': 'uninstall', + 'rb': 'rebuild', + 'list': 'ls', + 'ln': 'link', + 'i': 'install', + 'it': 'install-test', + 'up': 'update', + 'c': 'config', + 's': 'search', + 'se': 'search', + 'unstar': 'star', // same function + 'tst': 'test', + 't': 'test', + 'ddp': 'dedupe', + 'v': 'view' +} + +var affordances = { + 'la': 'ls', + 'll': 'ls', + 'verison': 'version', + 'isntall': 'install', + 'dist-tags': 'dist-tag', + 'apihelp': 'help', + 'find-dupes': 'dedupe', + 'upgrade': 'update', + 'login': 'adduser', + 'add-user': 'adduser', + 'author': 'owner', + 'home': 'docs', + 'issues': 'bugs', + 'info': 'view', + 'show': 'view', + 'find': 'search', + 'unlink': 'uninstall', + 'remove': 'uninstall', + 'rm': 'uninstall', + 'r': 'uninstall' +} + +// these are filenames in . +var cmdList = [ + 'install', + 'install-test', + 'uninstall', + 'cache', + 'config', + 'set', + 'get', + 'update', + 'outdated', + 'prune', + 'pack', + 'dedupe', + + 'rebuild', + 'link', + + 'publish', + 'star', + 'stars', + 'tag', + 'adduser', + 'logout', + 'unpublish', + 'owner', + 'access', + 'team', + 'deprecate', + 'shrinkwrap', + + 'help', + 'help-search', + 'ls', + 'search', + 'view', + 'init', + 'version', + 'edit', + 'explore', + 'docs', + 'repo', + 'bugs', + 'faq', + 'root', + 'prefix', + 'bin', + 'whoami', + 'dist-tag', + 'ping', + + 'test', + 'stop', + 'start', + 'restart', + 'run-script', + 'completion' +] + +var plumbing = [ + 'build', + 'unbuild', + 'xmas', + 'substack', + 'visnup' +] +module.exports.aliases = extend(extend({}, shorthands), affordances) +module.exports.shorthands = shorthands +module.exports.affordances = affordances +module.exports.cmdList = cmdList +module.exports.plumbing = plumbing diff --git a/deps/npm/lib/config/defaults.js b/deps/npm/lib/config/defaults.js index ee1e73851e..e93c1e57ec 100644 --- a/deps/npm/lib/config/defaults.js +++ b/deps/npm/lib/config/defaults.js @@ -165,6 +165,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { loglevel: 'warn', logstream: process.stderr, long: false, + maxsockets: 50, message: '%s', 'node-version': process.version, npat: false, @@ -276,6 +277,7 @@ exports.types = { loglevel: ['silent', 'error', 'warn', 'http', 'info', 'verbose', 'silly'], logstream: Stream, long: Boolean, + maxsockets: Number, message: String, 'node-version': [null, semver], npat: Boolean, diff --git a/deps/npm/lib/config/get-credentials-by-uri.js b/deps/npm/lib/config/get-credentials-by-uri.js index a073a594a5..19779c4137 100644 --- a/deps/npm/lib/config/get-credentials-by-uri.js +++ b/deps/npm/lib/config/get-credentials-by-uri.js @@ -20,6 +20,14 @@ function getCredentialsByURI (uri) { alwaysAuth: undefined } + // used to override scope matching for tokens as well as legacy auth + if (this.get(nerfed + ':always-auth') !== undefined) { + var val = this.get(nerfed + ':always-auth') + c.alwaysAuth = val === 'false' ? false : !!val + } else if (this.get('always-auth') !== undefined) { + c.alwaysAuth = this.get('always-auth') + } + if (this.get(nerfed + ':_authToken')) { c.token = this.get(nerfed + ':_authToken') // the bearer token is enough, don't confuse things @@ -58,13 +66,6 @@ function getCredentialsByURI (uri) { c.email = this.get('email') } - if (this.get(nerfed + ':always-auth') !== undefined) { - var val = this.get(nerfed + ':always-auth') - c.alwaysAuth = val === 'false' ? false : !!val - } else if (this.get('always-auth') !== undefined) { - c.alwaysAuth = this.get('always-auth') - } - if (c.username && c.password) { c.auth = new Buffer(c.username + ':' + c.password).toString('base64') } |