Mimic, replace or work around removed npm utils.

This commit is contained in:
Marcel Klehr 2012-10-28 18:34:20 +01:00
parent e447a6fade
commit 78e64ffea8
4 changed files with 24 additions and 7 deletions

View file

@ -1,7 +1,12 @@
var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins");
var hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks");
var npm = require("npm");
var registry = require("npm/lib/utils/npm-registry-client/index.js");
var RegClient = require("npm-registry-client")
var registry = new RegClient(
{ registry: "http://registry.npmjs.org"
, cache: npm.cache }
);
var withNpm = function (npmfn, final, cb) {
npm.load({}, function (er) {
@ -72,7 +77,7 @@ exports.search = function(query, cache, cb) {
cb(null, exports.searchCache);
} else {
registry.get(
"/-/all", null, 600, false, true,
"/-/all", 600, false, true,
function (er, data) {
if (er) return cb(er);
exports.searchCache = data;