From 7719cfdd8b204dfeccc41289707ea58b4d608905 Mon Sep 17 00:00:00 2001 From: Forrest L Norvell Date: Thu, 23 Oct 2014 23:12:19 -0700 Subject: 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. --- lib/search.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/search.js') diff --git a/lib/search.js b/lib/search.js index 5dd060f82..d2ce9a3c0 100644 --- a/lib/search.js +++ b/lib/search.js @@ -2,8 +2,7 @@ module.exports = exports = search var npm = require("./npm.js") - , registry = npm.registry - , columnify = require('columnify') + , columnify = require("columnify") , mapToRegistry = require("./utils/map-to-registry.js") search.usage = "npm search [some search terms ...]" @@ -58,15 +57,16 @@ function search (args, silent, staleness, cb) { } function getFilteredData (staleness, args, notArgs, cb) { - var opts = { - timeout : staleness, - follow : true, - staleOk : true - } - mapToRegistry("-/all", npm.config, function (er, uri) { + mapToRegistry("-/all", npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, opts, function (er, data) { + var params = { + timeout : staleness, + follow : true, + staleOk : true, + auth : auth + } + npm.registry.getAll(uri, params, function (er, data) { if (er) return cb(er) return cb(null, filter(data, args, notArgs)) }) -- cgit v1.2.3