summaryrefslogtreecommitdiff
path: root/deps/npm/lib/docs.js
diff options
context:
space:
mode:
authorForrest L Norvell <ogd@aoaioxxysz.net>2015-01-08 14:37:26 -0800
committerBen Noordhuis <info@bnoordhuis.nl>2015-01-08 23:49:03 +0100
commite79ccee1685393e4ec73746bac93835cbcf3a809 (patch)
tree304a1ddd59495b50a20d1b25c62da2a4519228db /deps/npm/lib/docs.js
parent156cd82ef4d2ff4fa291407de562c3a7c2386dc7 (diff)
downloadandroid-node-v8-e79ccee1685393e4ec73746bac93835cbcf3a809.tar.gz
android-node-v8-e79ccee1685393e4ec73746bac93835cbcf3a809.tar.bz2
android-node-v8-e79ccee1685393e4ec73746bac93835cbcf3a809.zip
npm: upgrade to v2.1.18
PR-URL: https://github.com/iojs/io.js/pull/266 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/npm/lib/docs.js')
-rw-r--r--deps/npm/lib/docs.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/deps/npm/lib/docs.js b/deps/npm/lib/docs.js
index dead3f7551..9abe740a3c 100644
--- a/deps/npm/lib/docs.js
+++ b/deps/npm/lib/docs.js
@@ -4,23 +4,22 @@ docs.usage = "npm docs <pkgname>"
docs.usage += "\n"
docs.usage += "npm docs ."
+var npm = require("./npm.js")
+ , opener = require("opener")
+ , path = require("path")
+ , log = require("npmlog")
+ , mapToRegistry = require("./utils/map-to-registry.js")
+
docs.completion = function (opts, cb) {
- mapToRegistry("/-/short", npm.config, function (er, uri) {
+ mapToRegistry("/-/short", npm.config, function (er, uri, auth) {
if (er) return cb(er)
- registry.get(uri, { timeout : 60000 }, function (er, list) {
+ npm.registry.get(uri, { timeout : 60000, auth : auth }, function (er, list) {
return cb(null, list || [])
})
})
}
-var npm = require("./npm.js")
- , registry = npm.registry
- , opener = require("opener")
- , path = require("path")
- , log = require("npmlog")
- , mapToRegistry = require("./utils/map-to-registry.js")
-
function url (json) {
return json.homepage ? json.homepage : "https://npmjs.org/package/" + json.name
}
@@ -28,7 +27,7 @@ function url (json) {
function docs (args, cb) {
args = args || []
var pending = args.length
- if (!pending) return getDoc('.', cb)
+ if (!pending) return getDoc(".", cb)
args.forEach(function(proj) {
getDoc(proj, function(err) {
if (err) {
@@ -40,10 +39,10 @@ function docs (args, cb) {
}
function getDoc (project, cb) {
- project = project || '.'
+ project = project || "."
var package = path.resolve(npm.localPrefix, "package.json")
- if (project === '.' || project === './') {
+ if (project === "." || project === "./") {
var json
try {
json = require(package)
@@ -57,10 +56,10 @@ function getDoc (project, cb) {
return opener(url(json), { command: npm.config.get("browser") }, cb)
}
- mapToRegistry(project, npm.config, function (er, uri) {
+ mapToRegistry(project, npm.config, function (er, uri, auth) {
if (er) return cb(er)
- registry.get(uri + "/latest", { timeout : 3600 }, next)
+ npm.registry.get(uri + "/latest", { timeout : 3600, auth : auth }, next)
})
function next (er, json) {