diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-10-24 10:12:19 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-10-31 11:18:12 +0300 |
commit | 7719cfdd8b204dfeccc41289707ea58b4d608905 (patch) | |
tree | d3638e35e4988a9ed789ad74ed4b5418fecb2255 /lib/view.js | |
parent | 20a331ced6a52faac6ec242e3ffdf28bcd447c40 (diff) |
use new npm-registry-client API
Makes a *lot* clearer when the CLI is doing something with auth
implications, by explicitly pass auth to registry client. Moves lookup
of credentials into mapRegistryToURI, which makes the code more
consistent.
Diffstat (limited to 'lib/view.js')
-rw-r--r-- | lib/view.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/view.js b/lib/view.js index 6b45cca2e..c2605cf0a 100644 --- a/lib/view.js +++ b/lib/view.js @@ -5,18 +5,18 @@ view.usage = "npm view pkg[@version] [<field>[.subfield]...]" view.completion = function (opts, cb) { if (opts.conf.argv.remain.length <= 2) { - return mapToRegistry("-/short", npm.config, function (er, uri) { + return mapToRegistry("-/short", npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, cb) + npm.registry.get(uri, { auth : auth }, cb) }) } // have the package, get the fields. var tag = npm.config.get("tag") - mapToRegistry(opts.conf.argv.remain[2], npm.config, function (er, uri) { + mapToRegistry(opts.conf.argv.remain[2], npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, d) { + npm.registry.get(uri, { auth : auth }, function (er, d) { if (er) return cb(er) var dv = d.versions[d["dist-tags"][tag]] , fields = [] @@ -97,10 +97,10 @@ function fetchAndRead (nv, args, silent, cb) { var name = nv.name , version = nv.rawSpec || npm.config.get("tag") - mapToRegistry(name, npm.config, function (er, uri) { + mapToRegistry(name, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, data) { + npm.registry.get(uri, { auth : auth }, function (er, data) { if (er) return cb(er) if (data["dist-tags"] && data["dist-tags"].hasOwnProperty(version)) { version = data["dist-tags"][version] |