Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--node_modules/npm-registry-client/README.md96
-rw-r--r--node_modules/npm-registry-client/index.js4
-rw-r--r--node_modules/npm-registry-client/lib/adduser.js24
-rw-r--r--node_modules/npm-registry-client/lib/bugs.js4
-rw-r--r--node_modules/npm-registry-client/lib/deprecate.js8
-rw-r--r--node_modules/npm-registry-client/lib/get.js100
-rw-r--r--node_modules/npm-registry-client/lib/publish.js24
-rw-r--r--node_modules/npm-registry-client/lib/request.js46
-rw-r--r--node_modules/npm-registry-client/lib/star.js6
-rw-r--r--node_modules/npm-registry-client/lib/stars.js6
-rw-r--r--node_modules/npm-registry-client/lib/tag.js5
-rw-r--r--node_modules/npm-registry-client/lib/unpublish.js32
-rw-r--r--node_modules/npm-registry-client/lib/upload.js6
-rw-r--r--node_modules/npm-registry-client/package.json28
-rw-r--r--node_modules/npm-registry-client/test/00-setup.js10
-rw-r--r--node_modules/npm-registry-client/test/adduser-new.js39
-rw-r--r--node_modules/npm-registry-client/test/adduser-update.js41
-rw-r--r--node_modules/npm-registry-client/test/basic.js32
-rw-r--r--node_modules/npm-registry-client/test/bugs.js33
-rw-r--r--node_modules/npm-registry-client/test/deprecate.js66
-rw-r--r--node_modules/npm-registry-client/test/get-all.js16
-rw-r--r--node_modules/npm-registry-client/test/get-basic.js27
-rw-r--r--node_modules/npm-registry-client/test/lib/common.js17
-rw-r--r--node_modules/npm-registry-client/test/lib/server.js58
-rw-r--r--node_modules/npm-registry-client/test/publish-again.js40
-rw-r--r--node_modules/npm-registry-client/test/publish.js43
-rw-r--r--node_modules/npm-registry-client/test/request-gzip-content.js52
-rw-r--r--node_modules/npm-registry-client/test/retries.js49
-rw-r--r--node_modules/npm-registry-client/test/star.js60
-rw-r--r--node_modules/npm-registry-client/test/stars.js32
-rw-r--r--node_modules/npm-registry-client/test/tag.js39
-rw-r--r--node_modules/npm-registry-client/test/unpublish.js59
-rw-r--r--node_modules/npm-registry-client/test/upload.js37
-rw-r--r--node_modules/npm-registry-client/test/zz-cleanup.js10
-rw-r--r--package.json2
35 files changed, 817 insertions, 334 deletions
diff --git a/node_modules/npm-registry-client/README.md b/node_modules/npm-registry-client/README.md
index 4b3d4c3c6..b8f212e85 100644
--- a/node_modules/npm-registry-client/README.md
+++ b/node_modules/npm-registry-client/README.md
@@ -18,6 +18,15 @@ client.get("npm", "latest", 1000, function (er, data, raw, res) {
})
```
+# Registry URLs
+
+The registry calls take either a full URL pointing to a resource in the
+registry, or a base URL for the registry as a whole (for the base URL, any path
+will be ignored). In addition to `http` and `https`, `npm` URLs are allowed.
+`npm` URLs are `https` URLs with the additional restrictions that they will
+always include authorization credentials, and the response is always registry
+metadata (and not tarballs or other attachments).
+
# Configuration
This program is designed to work with
@@ -26,7 +35,6 @@ a plain-jane object with the appropriate configs, and it'll shim it
for you. Any configuration thingie that has get/set/del methods will
also be accepted.
-* `registry` **Required** {String} URL to the registry
* `cache` **Required** {String} Path to the cache folder
* `always-auth` {Boolean} Auth even for GET requests.
* `auth` {String} A base64-encoded `username:password`
@@ -59,25 +67,27 @@ also be accepted.
* `_token` {Object} A token for use with
[couch-login](https://npmjs.org/package/couch-login)
-# client.request(method, where, [what], [etag], [nofollow], cb)
+# client.request(method, uri, options, cb)
* `method` {String} HTTP method
-* `where` {String} Path to request on the server
-* `what` {Stream | Buffer | String | Object} The request body. Objects
- that are not Buffers or Streams are encoded as JSON.
-* `etag` {String} The cached ETag
-* `nofollow` {Boolean} Prevent following 302/301 responses
+* `uri` {String} URI pointing to the resource to request
+* `options` {Object} Object containing optional per-request properties.
+ * `what` {Stream | Buffer | String | Object} The request body. Objects
+ that are not Buffers or Streams are encoded as JSON.
+ * `etag` {String} The cached ETag
+ * `follow` {Boolean} Follow 302/301 responses (defaults to true)
* `cb` {Function}
* `error` {Error | null}
* `data` {Object} the parsed data object
* `raw` {String} the json
* `res` {Response Object} response from couch
-Make a request to the registry. All the other methods are wrappers
-around this. one.
+Make a request to the registry. All the other methods are wrappers around
+`request`.
-# client.adduser(username, password, email, cb)
+# client.adduser(base, username, password, email, cb)
+* `base` {String} Base registry URL
* `username` {String}
* `password` {String}
* `email` {String}
@@ -85,88 +95,88 @@ around this. one.
Add a user account to the registry, or verify the credentials.
-# client.deprecate(name, version, message, cb)
+# client.deprecate(uri, version, message, cb)
-* `name` {String} The package name
+* `uri` {String} Full registry URI for the deprecated package
* `version` {String} Semver version range
* `message` {String} The message to use as a deprecation warning
* `cb` {Function}
Deprecate a version of a package in the registry.
-# client.bugs(name, cb)
+# client.bugs(uri, cb)
-* `name` {String} the name of the package
+* `uri` {String} Full registry URI for the package
* `cb` {Function}
Get the url for bugs of a package
-# client.get(url, [timeout], [nofollow], [staleOk], cb)
+# client.get(uri, options, cb)
-* `url` {String} The url path to fetch
-* `timeout` {Number} Number of seconds old that a cached copy must be
- before a new request will be made.
-* `nofollow` {Boolean} Do not follow 301/302 responses
-* `staleOk` {Boolean} If there's cached data available, then return that
- to the callback quickly, and update the cache the background.
+* `uri` {String} The complete registry URI to fetch
+* `options` {Object} Object containing optional per-request properties.
+ * `timeout` {Number} Duration before the request times out.
+ * `follow` {Boolean} Follow 302/301 responses (defaults to true)
+ * `staleOk` {Boolean} If there's cached data available, then return that
+ to the callback quickly, and update the cache the background.
-Fetches data from the registry via a GET request, saving it in
-the cache folder with the ETag.
+Fetches data from the registry via a GET request, saving it in the cache folder
+with the ETag.
-# client.publish(data, tarball, cb)
+# client.publish(uri, data, tarball, cb)
+* `uri` {String} The registry URI to publish to
* `data` {Object} Package data
* `tarball` {String | Stream} Filename or stream of the package tarball
* `cb` {Function}
Publish a package to the registry.
-Note that this does not create the tarball from a folder. However, it
-can accept a gzipped tar stream or a filename to a tarball.
+Note that this does not create the tarball from a folder. However, it can
+accept a gzipped tar stream or a filename to a tarball.
-# client.star(package, starred, cb)
+# client.star(uri, starred, cb)
-* `package` {String} Name of the package to star
+* `uri` {String} The complete registry URI to star
* `starred` {Boolean} True to star the package, false to unstar it.
* `cb` {Function}
Star or unstar a package.
-Note that the user does not have to be the package owner to star or
-unstar a package, though other writes do require that the user be the
-package owner.
+Note that the user does not have to be the package owner to star or unstar a
+package, though other writes do require that the user be the package owner.
-# client.stars(username, cb)
+# client.stars(base, username, cb)
+* `base` {String} The base URL for the registry
* `username` {String} Name of user to fetch starred packages for.
* `cb` {Function}
View your own or another user's starred packages.
-# client.tag(project, version, tag, cb)
+# client.tag(uri, version, tag, cb)
-* `project` {String} Project name
+* `uri` {String} The complete registry URI to tag
* `version` {String} Version to tag
* `tag` {String} Tag name to apply
* `cb` {Function}
-Mark a version in the `dist-tags` hash, so that `pkg@tag`
-will fetch the specified version.
+Mark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the
+specified version.
-# client.unpublish(name, [ver], cb)
+# client.unpublish(uri, [ver], cb)
-* `name` {String} package name
+* `uri` {String} The complete registry URI to unpublish
* `ver` {String} version to unpublish. Leave blank to unpublish all
versions.
* `cb` {Function}
-Remove a version of a package (or all versions) from the registry. When
-the last version us unpublished, the entire document is removed from the
-database.
+Remove a version of a package (or all versions) from the registry. When the
+last version us unpublished, the entire document is removed from the database.
-# client.upload(where, file, [etag], [nofollow], cb)
+# client.upload(uri, file, [etag], [nofollow], cb)
-* `where` {String} URL path to upload to
+* `uri` {String} The complete registry URI to upload to
* `file` {String | Stream} Either the filename or a readable stream
* `etag` {String} Cache ETag
* `nofollow` {Boolean} Do not follow 301/302 responses
diff --git a/node_modules/npm-registry-client/index.js b/node_modules/npm-registry-client/index.js
index eac60d605..a75e8bbdb 100644
--- a/node_modules/npm-registry-client/index.js
+++ b/node_modules/npm-registry-client/index.js
@@ -2,9 +2,7 @@
module.exports = RegClient
-var fs = require('fs')
-, url = require('url')
-, path = require('path')
+var url = require('url')
, npmlog
, cacheFile = require('npm-cache-filename')
diff --git a/node_modules/npm-registry-client/lib/adduser.js b/node_modules/npm-registry-client/lib/adduser.js
index 5a76b028c..d1fcac8e9 100644
--- a/node_modules/npm-registry-client/lib/adduser.js
+++ b/node_modules/npm-registry-client/lib/adduser.js
@@ -1,6 +1,12 @@
module.exports = adduser
-function adduser (username, password, email, cb) {
+var url = require("url")
+
+function adduser (base, username, password, email, cb) {
+ if (!base) return cb(new Error("Required base URI not supplied"))
+
+ username = ("" + (username || "")).trim()
+ if (!username) return cb(new Error("No username supplied."))
password = ("" + (password || "")).trim()
if (!password) return cb(new Error("No password supplied."))
@@ -48,9 +54,10 @@ function adduser (username, password, email, cb) {
this.log.verbose("adduser", "before first PUT", logObj)
+ var uri = url.resolve(base, '/-/user/org.couchdb.user:' + encodeURIComponent(username))
this.request('PUT'
- , '/-/user/org.couchdb.user:'+encodeURIComponent(username)
- , userobj
+ , uri
+ , { body : userobj }
, function (error, data, json, response) {
// if it worked, then we just created a new user, and all is well.
// but if we're updating a current record, then it'll 409 first
@@ -69,8 +76,8 @@ function adduser (username, password, email, cb) {
this.log.verbose("adduser", "update existing user")
return this.request('GET'
- , '/-/user/org.couchdb.user:'+encodeURIComponent(username) +
- '?write=true'
+ , uri + '?write=true'
+ , null
, function (er, data, json, response) {
if (er || data.error) {
return cb(er, data, json, response)
@@ -82,10 +89,9 @@ function adduser (username, password, email, cb) {
})
this.log.verbose("adduser", "userobj", logObj)
this.request('PUT'
- , '/-/user/org.couchdb.user:'+encodeURIComponent(username)
- + "/-rev/" + userobj._rev
- , userobj
- , cb )
+ , uri + "/-rev/" + userobj._rev
+ , { body : userobj }
+ , cb)
}.bind(this))
}.bind(this))
}
diff --git a/node_modules/npm-registry-client/lib/bugs.js b/node_modules/npm-registry-client/lib/bugs.js
index a04701316..fd0365eed 100644
--- a/node_modules/npm-registry-client/lib/bugs.js
+++ b/node_modules/npm-registry-client/lib/bugs.js
@@ -1,8 +1,8 @@
module.exports = bugs
-function bugs (name, cb) {
- this.get(name + "/latest", 3600, function (er, d) {
+function bugs (uri, cb) {
+ this.get(uri + "/latest", 3600, function (er, d) {
if (er) return cb(er)
cb(null, d.bugs)
})
diff --git a/node_modules/npm-registry-client/lib/deprecate.js b/node_modules/npm-registry-client/lib/deprecate.js
index 9cbc6d88e..078968dd3 100644
--- a/node_modules/npm-registry-client/lib/deprecate.js
+++ b/node_modules/npm-registry-client/lib/deprecate.js
@@ -1,9 +1,9 @@
-
module.exports = deprecate
+var url = require("url")
var semver = require("semver")
-function deprecate (name, ver, message, cb) {
+function deprecate (uri, ver, message, cb) {
if (!this.conf.get('username')) {
return cb(new Error("Must be logged in to deprecate a package"))
}
@@ -12,7 +12,7 @@ function deprecate (name, ver, message, cb) {
return cb(new Error("invalid version range: "+ver))
}
- this.get(name + '?write=true', function (er, data) {
+ this.get(uri + '?write=true', null, function (er, data) {
if (er) return cb(er)
// filter all the versions that match
Object.keys(data.versions).filter(function (v) {
@@ -21,6 +21,6 @@ function deprecate (name, ver, message, cb) {
data.versions[v].deprecated = message
})
// now update the doc on the registry
- this.request('PUT', data._id, data, cb)
+ this.request('PUT', url.resolve(uri, data._id), { body : data }, cb)
}.bind(this))
}
diff --git a/node_modules/npm-registry-client/lib/get.js b/node_modules/npm-registry-client/lib/get.js
index 9aab7d7b0..d7b58092b 100644
--- a/node_modules/npm-registry-client/lib/get.js
+++ b/node_modules/npm-registry-client/lib/get.js
@@ -2,83 +2,94 @@
module.exports = get
var fs = require("graceful-fs")
+ , assert = require("assert")
, path = require("path")
, mkdir = require("mkdirp")
, chownr = require("chownr")
-
-function get (uri, timeout, nofollow, staleOk, cb) {
- if (typeof cb !== "function") cb = staleOk, staleOk = false
- if (typeof cb !== "function") cb = nofollow, nofollow = false
- if (typeof cb !== "function") cb = timeout, timeout = -1
-
- timeout = Math.min(timeout, this.conf.get('cache-max') || 0)
- timeout = Math.max(timeout, this.conf.get('cache-min') || -Infinity)
-
- if (!this.conf.get('registry')) timeout = Infinity
-
- if ( process.env.COMP_CWORD !== undefined
- && process.env.COMP_LINE !== undefined
- && process.env.COMP_POINT !== undefined
- ) timeout = Math.max(timeout, 60000)
-
- var cache = this.cacheFile(this.registry + uri) + "/.cache.json"
+ , url = require("url")
+
+/**
+ * options:
+ *
+ * timeout: request timeouts
+ * follow: follow redirects
+ * staleOk: stale results are OK
+ * stat: results of checking for cached metadata
+ * data: the cached metadata
+ */
+function get (uri, options, cb) {
+ assert(uri, "must have URL to fetch")
+ assert(cb, "must have callback")
+ if (!options) options = {}
+
+ var parsed = url.parse(uri)
+ assert(parsed.protocol, "must have a URL that starts with npm:, http:, or https:")
+
+ var cache = this.cacheFile(uri) + "/.cache.json"
// /-/all is special.
// It uses timestamp-based caching and partial updates,
// because it is a monster.
- if (uri === "/-/all") {
- return requestAll.call(this, cache, cb)
+ if (parsed.pathname === "/-/all") {
+ return requestAll.call(this, uri, cache, cb)
}
// If the GET is part of a write operation (PUT or DELETE), then
// skip past the cache entirely, but still save the results.
- if (uri.match(/\?write=true$/))
- return get_.call(this, uri, timeout, cache, null, null, nofollow, staleOk, cb)
-
+ if (uri.match(/\?write=true$/)) {
+ return get_.call(this, uri, cache, options, cb)
+ }
fs.stat(cache, function (er, stat) {
if (!er) fs.readFile(cache, function (er, data) {
try { data = JSON.parse(data) }
catch (ex) { data = null }
- get_.call(this, uri, timeout, cache, stat, data, nofollow, staleOk, cb)
+ options.stat = stat
+ options.data = data
+ get_.call(this, uri, cache, options, cb)
}.bind(this))
- else get_.call(this, uri, timeout, cache, null, null, nofollow, staleOk, cb)
+ else {
+ get_.call(this, uri, cache, options, cb)
+ }
}.bind(this))
}
-function requestAll (cache, cb) {
+function requestAll (uri, cache, cb) {
+ this.log.info("get", cache)
mkdir(path.dirname(cache), function (er) {
+ if (er) return cb(er)
fs.readFile(cache, function (er, data) {
- if (er) return requestAll_.call(this, 0, {}, cache, cb)
+ if (er) return requestAll_.call(this, uri, 0, {}, cache, cb)
try {
data = JSON.parse(data)
} catch (ex) {
fs.writeFile(cache, "{}", function (er) {
if (er) return cb(new Error("Broken cache."))
- return requestAll_.call(this, 0, {}, cache, cb)
+ return requestAll_.call(this, uri, 0, {}, cache, cb)
}.bind(this))
}
var t = +data._updated || 0
- requestAll_.call(this, t, data, cache, cb)
+ requestAll_.call(this, uri, t, data, cache, cb)
}.bind(this))
}.bind(this))
}
-function requestAll_ (c, data, cache, cb) {
+function requestAll_ (uri, c, data, cache, cb) {
// use the cache and update in the background if it's not too old
if (Date.now() - c < 60000) {
cb(null, data)
cb = function () {}
}
- var uri = "/-/all/since?stale=update_after&startkey=" + c
-
if (c === 0) {
this.log.warn("", "Building the local index for the first time, please be patient")
- uri = "/-/all"
+ uri = url.resolve(uri, "/-/all")
+ }
+ else {
+ uri = url.resolve(uri, "/-/all/since?stale=update_after&startkey=" + c)
}
- this.request('GET', uri, function (er, updates, _, res) {
+ this.request('GET', uri, null, function (er, updates, _, res) {
if (er) return cb(er, data)
var headers = res.headers
, updated = updates._updated || Date.parse(headers.date)
@@ -94,10 +105,25 @@ function requestAll_ (c, data, cache, cb) {
})
}
-function get_ (uri, timeout, cache, stat, data, nofollow, staleOk, cb) {
- var etag
+function get_ (uri, cache, options, cb) {
+ var staleOk = options.staleOk === undefined ? false : options.staleOk
+ , follow = options.follow
+ , data = options.data
+ , stat = options.stat
+ , etag
+
+ var timeout = options.timeout === undefined ? -1 : options.timeout
+ timeout = Math.min(timeout, this.conf.get('cache-max') || 0)
+ timeout = Math.max(timeout, this.conf.get('cache-min') || -Infinity)
+ if (process.env.COMP_CWORD !== undefined &&
+ process.env.COMP_LINE !== undefined &&
+ process.env.COMP_POINT !== undefined) {
+ timeout = Math.max(timeout, 60000)
+ }
+
if (data && data._etag) etag = data._etag
- if (timeout && timeout > 0 && stat && data) {
+
+ if (timeout && timeout > 0 && options.stat && options.data) {
if ((Date.now() - stat.mtime.getTime())/1000 < timeout) {
this.log.verbose("registry.get", uri, "not expired, no request")
delete data._etag
@@ -112,7 +138,7 @@ function get_ (uri, timeout, cache, stat, data, nofollow, staleOk, cb) {
}
}
- this.request('GET', uri, null, etag, nofollow, function (er, remoteData, raw, response) {
+ this.request('GET', uri, { etag : etag, follow : follow }, function (er, remoteData, raw, response) {
// if we get an error talking to the registry, but we have it
// from the cache, then just pretend we got it.
if (er && cache && data && !data.error) {
diff --git a/node_modules/npm-registry-client/lib/publish.js b/node_modules/npm-registry-client/lib/publish.js
index 2a503802a..5504658d3 100644
--- a/node_modules/npm-registry-client/lib/publish.js
+++ b/node_modules/npm-registry-client/lib/publish.js
@@ -6,7 +6,7 @@ var url = require("url")
, crypto = require("crypto")
, fs = require("fs")
-function publish (data, tarball, cb) {
+function publish (uri, data, tarball, cb) {
var email = this.conf.get('email')
var auth = this.conf.get('_auth')
var username = this.conf.get('username')
@@ -30,12 +30,12 @@ function publish (data, tarball, cb) {
if (er) return cb(er)
fs.readFile(tarball, function(er, tarbuffer) {
if (er) return cb(er)
- putFirst.call(self, data, tarbuffer, s, username, email, cb)
+ putFirst.call(self, uri, data, tarbuffer, s, username, email, cb)
})
})
}
-function putFirst (data, tarbuffer, stat, username, email, cb) {
+function putFirst (registry, data, tarbuffer, stat, username, email, cb) {
// optimistically try to PUT all in one single atomic thing.
// If 409, then GET and merge, try again.
// If other error, then fail.
@@ -59,7 +59,6 @@ function putFirst (data, tarbuffer, stat, username, email, cb) {
var tag = data.tag || this.conf.get('tag') || "latest"
root["dist-tags"][tag] = data.version
- var registry = this.conf.get('registry')
var tbName = data.name + "-" + data.version + ".tgz"
, tbURI = data.name + "/-/" + tbName
@@ -76,7 +75,8 @@ function putFirst (data, tarbuffer, stat, username, email, cb) {
length: stat.size
};
- this.request("PUT", data.name, root, function (er, parsed, json, res) {
+ var fixed = url.resolve(registry, data.name)
+ this.request("PUT", fixed, { body : root }, function (er, parsed, json, res) {
var r409 = "must supply latest _rev to update existing package"
var r409b = "Document update conflict."
var conflict = res && res.statusCode === 409
@@ -94,16 +94,16 @@ function putFirst (data, tarbuffer, stat, username, email, cb) {
return cb(er, parsed, json, res)
// let's see what versions are already published.
- var getUrl = data.name + "?write=true"
- this.request("GET", getUrl, function (er, current) {
- if (er)
- return cb(er)
- putNext.call(this, data.version, root, current, cb)
+ var getUrl = url.resolve(registry, data.name + "?write=true")
+ this.request("GET", getUrl, null, function (er, current) {
+ if (er) return cb(er)
+
+ putNext.call(this, registry, data.version, root, current, cb)
}.bind(this))
}.bind(this))
}
-function putNext(newVersion, root, current, cb) {
+function putNext(registry, newVersion, root, current, cb) {
// already have the tardata on the root object
// just merge in existing stuff
var curVers = Object.keys(current.versions || {}).map(function (v) {
@@ -143,7 +143,7 @@ function putNext(newVersion, root, current, cb) {
var maint = JSON.parse(JSON.stringify(root.maintainers))
root.versions[newVersion].maintainers = maint
- this.request("PUT", root.name, current, cb)
+ this.request("PUT", url.resolve(registry, root.name), { body : current }, cb)
}
function conflictError (pkgid, version) {
diff --git a/node_modules/npm-registry-client/lib/request.js b/node_modules/npm-registry-client/lib/request.js
index 4af0b8ff3..f53160c12 100644
--- a/node_modules/npm-registry-client/lib/request.js
+++ b/node_modules/npm-registry-client/lib/request.js
@@ -2,27 +2,52 @@ module.exports = regRequest
var url = require("url")
, zlib = require("zlib")
+ , assert = require("assert")
, rm = require("rimraf")
- , asyncMap = require("slide").asyncMap
, Stream = require("stream").Stream
, request = require("request")
, retry = require("retry")
, crypto = require("crypto")
, pkg = require("../package.json")
-function regRequest (method, where, what, etag, nofollow, cb_) {
- if (typeof cb_ !== "function") cb_ = nofollow, nofollow = false
- if (typeof cb_ !== "function") cb_ = etag, etag = null
- if (typeof cb_ !== "function") cb_ = what, what = null
+
+// npm: means
+// 1. https
+// 2. send authorization
+// 3. content-type is 'application/json' -- metadata
+function regRequest (method, uri, options, cb_) {
+ assert(uri, "must pass resource to load")
+ assert(cb_, "must pass callback")
+
+ options = options || {}
+ var nofollow = !options.follow
+ var etag = options.etag
+ var what = options.body
+
+ var parsed = url.parse(uri)
+
+ var authThis = false
+ if (parsed.protocol === "npm") {
+ parsed.protocol = "https"
+ authThis = true
+ }
+
+ var where = parsed.pathname
+ if (parsed.search) {
+ where = where + parsed.search
+ parsed.search = ""
+ }
+ parsed.pathname = "/"
+ this.log.verbose("request", "where is", where)
+
+ var registry = url.format(parsed)
+ this.log.verbose("request", "registry", registry)
if (!this.sessionToken) {
this.sessionToken = crypto.randomBytes(8).toString("hex")
+ this.log.verbose("request id", this.sessionToken)
}
- var registry = this.conf.get('registry')
- if (!registry) return cb(new Error(
- "No registry url provided: " + method + " " + where))
-
// Since there are multiple places where an error could occur,
// don't let the cb be called more than once.
var errState = null
@@ -43,7 +68,7 @@ function regRequest (method, where, what, etag, nofollow, cb_) {
, alwaysAuth = this.conf.get('always-auth')
, isDel = method === "DELETE"
, isWrite = what || isDel
- , authRequired = (alwaysAuth || isWrite) && !nu || uc || isDel
+ , authRequired = (authThis || alwaysAuth || isWrite) && !nu || uc || isDel
// resolve to a full url on the registry
if (!where.match(/^https?:\/\//)) {
@@ -66,6 +91,7 @@ function regRequest (method, where, what, etag, nofollow, cb_) {
where = url.resolve(registry, where)
this.log.verbose("url resolved", where)
}
+ this.log.verbose("request", "where is", where)
var remote = url.parse(where)
, auth = this.conf.get('_auth')
diff --git a/node_modules/npm-registry-client/lib/star.js b/node_modules/npm-registry-client/lib/star.js
index 23fbd9169..c0590f1e2 100644
--- a/node_modules/npm-registry-client/lib/star.js
+++ b/node_modules/npm-registry-client/lib/star.js
@@ -1,11 +1,11 @@
module.exports = star
-function star (package, starred, cb) {
+function star (uri, starred, cb) {
if (!this.conf.get('username')) return cb(new Error(
"Must be logged in to star/unstar packages"))
- this.request("GET", package + '?write=true', function (er, fullData) {
+ this.request("GET", uri+"?write=true", null, function (er, fullData) {
if (er) return cb(er)
fullData = { _id: fullData._id
@@ -22,6 +22,6 @@ function star (package, starred, cb) {
this.log.verbose("unstarring", fullData)
}
- return this.request("PUT", package, fullData, cb)
+ return this.request("PUT", uri, { body : fullData }, cb)
}.bind(this))
}
diff --git a/node_modules/npm-registry-client/lib/stars.js b/node_modules/npm-registry-client/lib/stars.js
index 4ef57e271..86a252efb 100644
--- a/node_modules/npm-registry-client/lib/stars.js
+++ b/node_modules/npm-registry-client/lib/stars.js
@@ -1,7 +1,9 @@
+var url = require("url")
+
module.exports = stars
-function stars (name, cb) {
+function stars (base, name, cb) {
name = encodeURIComponent(name)
var path = "/-/_view/starredByUser?key=\""+name+"\""
- this.request("GET", path, cb)
+ this.request("GET", url.resolve(base, path), null, cb)
}
diff --git a/node_modules/npm-registry-client/lib/tag.js b/node_modules/npm-registry-client/lib/tag.js
index d7ebf08a6..65430fe93 100644
--- a/node_modules/npm-registry-client/lib/tag.js
+++ b/node_modules/npm-registry-client/lib/tag.js
@@ -1,6 +1,5 @@
-
module.exports = tag
-function tag (project, version, tagName, cb) {
- this.request("PUT", project+"/"+tagName, JSON.stringify(version), cb)
+function tag (uri, version, tagName, cb) {
+ this.request("PUT", uri+"/"+tagName, { body : JSON.stringify(version) }, cb)
}
diff --git a/node_modules/npm-registry-client/lib/unpublish.js b/node_modules/npm-registry-client/lib/unpublish.js
index 1887a99e6..fc2e3b559 100644
--- a/node_modules/npm-registry-client/lib/unpublish.js
+++ b/node_modules/npm-registry-client/lib/unpublish.js
@@ -11,19 +11,18 @@ var semver = require("semver")
, url = require("url")
, chain = require("slide").chain
-function unpublish (name, ver, cb) {
+function unpublish (uri, ver, cb) {
if (typeof cb !== "function") cb = ver, ver = null
- var u = name + '?write=true'
- this.get(u, null, -1, true, function (er, data) {
+ this.get(uri + "?write=true", { timeout : -1, follow : false }, function (er, data) {
if (er) {
- this.log.info("unpublish", name+" not published")
+ this.log.info("unpublish", uri+" not published")
return cb()
}
// remove all if no version specified
if (!ver) {
this.log.info("unpublish", "No version specified, removing all")
- return this.request("DELETE", name+'/-rev/'+data._rev, cb)
+ return this.request("DELETE", uri+'/-rev/'+data._rev, cb)
}
var versions = data.versions || {}
@@ -31,7 +30,7 @@ function unpublish (name, ver, cb) {
var dist
if (!versionPublic) {
- this.log.info("unpublish", name+"@"+ver+" not published")
+ this.log.info("unpublish", uri+"@"+ver+" not published")
} else {
dist = versions[ver].dist
this.log.verbose("unpublish", "removing attachments", dist)
@@ -41,7 +40,7 @@ function unpublish (name, ver, cb) {
// if it was the only version, then delete the whole package.
if (!Object.keys(versions).length) {
this.log.info("unpublish", "No versions remain, removing entire package")
- return this.request("DELETE", name+"/-rev/"+data._rev, cb)
+ return this.request("DELETE", uri + "/-rev/" + data._rev, null, cb)
}
if (!versionPublic) return cb()
@@ -59,8 +58,9 @@ function unpublish (name, ver, cb) {
var rev = data._rev
delete data._revisions
delete data._attachments
- var cb_ = detacher.call(this, data, dist, cb)
- this.request("PUT", name+"/-rev/"+rev, data, function (er) {
+ var cb_ = detacher.call(this, uri, data, dist, cb)
+
+ this.request("PUT", uri + "/-rev/" + rev, { body : data }, function (er) {
if (er) {
this.log.error("unpublish", "Failed to update data")
}
@@ -69,20 +69,20 @@ function unpublish (name, ver, cb) {
}.bind(this))
}
-function detacher (data, dist, cb) {
+function detacher (uri, data, dist, cb) {
return function (er) {
if (er) return cb(er)
- this.get(data.name, function (er, data) {
+ this.get(url.resolve(uri, data.name), null, function (er, data) {
if (er) return cb(er)
var tb = url.parse(dist.tarball)
- detach.call(this, data, tb.pathname, data._rev, function (er) {
+ detach.call(this, uri, data, tb.pathname, data._rev, function (er) {
if (er || !dist.bin) return cb(er)
chain(Object.keys(dist.bin).map(function (bt) {
return function (cb) {
var d = dist.bin[bt]
- detach.call(this, data, url.parse(d.tarball).pathname, null, cb)
+ detach.call(this, uri, data, url.parse(d.tarball).pathname, null, cb)
}.bind(this)
}, this), cb)
}.bind(this))
@@ -90,13 +90,13 @@ function detacher (data, dist, cb) {
}.bind(this)
}
-function detach (data, path, rev, cb) {
+function detach (uri, data, path, rev, cb) {
if (rev) {
path += "/-rev/" + rev
this.log.info("detach", path)
- return this.request("DELETE", path, cb)
+ return this.request("DELETE", url.resolve(uri, path), null, cb)
}
- this.get(data.name, function (er, data) {
+ this.get(url.resolve(uri, data.name), null, function (er, data) {
rev = data._rev
if (!rev) return cb(new Error(
"No _rev found in "+data._id))
diff --git a/node_modules/npm-registry-client/lib/upload.js b/node_modules/npm-registry-client/lib/upload.js
index 2418997b4..f624a266c 100644
--- a/node_modules/npm-registry-client/lib/upload.js
+++ b/node_modules/npm-registry-client/lib/upload.js
@@ -3,12 +3,12 @@ module.exports = upload
var fs = require('fs')
, Stream = require("stream").Stream
-function upload (where, file, etag, nofollow, cb) {
+function upload (uri, file, etag, nofollow, cb) {
if (typeof nofollow === "function") cb = nofollow, nofollow = false
if (typeof etag === "function") cb = etag, etag = null
if (file instanceof Stream) {
- return this.request("PUT", where, file, etag, nofollow, cb)
+ return this.request("PUT", uri, { body : file, etag : etag, follow : !nofollow }, cb)
}
fs.stat(file, function (er, stat) {
@@ -17,6 +17,6 @@ function upload (where, file, etag, nofollow, cb) {
s.size = stat.size
s.on("error", cb)
- this.request("PUT", where, s, etag, nofollow, cb)
+ this.request("PUT", uri, { body : s, etag : etag, follow : !nofollow }, cb)
}.bind(this))
}
diff --git a/node_modules/npm-registry-client/package.json b/node_modules/npm-registry-client/package.json
index 152a51f40..0448cf0d6 100644
--- a/node_modules/npm-registry-client/package.json
+++ b/node_modules/npm-registry-client/package.json
@@ -6,7 +6,7 @@
},
"name": "npm-registry-client",
"description": "Client for the npm registry",
- "version": "1.0.0",
+ "version": "2.0.0",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
@@ -33,13 +33,29 @@
"npmlog": ""
},
"license": "BSD",
- "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(config)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Configuration\n\nThis program is designed to work with\n[npmconf](https://npmjs.org/package/npmconf), but you can also pass in\na plain-jane object with the appropriate configs, and it'll shim it\nfor you. Any configuration thingie that has get/set/del methods will\nalso be accepted.\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `always-auth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `cert` {String} Client certificate (PEM encoded). Enable access\n to servers that require client certificates\n* `key` {String} Private key (PEM encoded) for client certificate 'cert'\n* `strict-ssl` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `user-agent` {String} User agent header to send. Default =\n `\"node/{process.version} {process.platform} {process.arch}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `fetch-retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10\n* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n* `proxy` {URL} The url to proxy requests through.\n* `https-proxy` {URL} The url to proxy https requests through.\n Defaults to be the same as `proxy` if unset.\n* `_auth` {String} The base64-encoded authorization header.\n* `username` `_password` {String} Username/password to use to generate\n `_auth` if not supplied.\n* `_token` {Object} A token for use with\n [couch-login](https://npmjs.org/package/couch-login)\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.deprecate(name, version, message, cb)\n\n* `name` {String} The package name\n* `version` {String} Semver version range\n* `message` {String} The message to use as a deprecation warning\n* `cb` {Function}\n\nDeprecate a version of a package in the registry.\n\n# client.bugs(name, cb)\n\n* `name` {String} the name of the package\n* `cb` {Function}\n\nGet the url for bugs of a package\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.stars(username, cb)\n\n* `username` {String} Name of user to fetch starred packages for.\n* `cb` {Function}\n\nView your own or another user's starred packages.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n",
- "readmeFilename": "README.md",
+ "gitHead": "47a98069b6a34e751cbd5b84ce92858cae5abe70",
"bugs": {
"url": "https://github.com/isaacs/npm-registry-client/issues"
},
"homepage": "https://github.com/isaacs/npm-registry-client",
- "_id": "npm-registry-client@1.0.0",
- "_shasum": "2a6f9dfdce5f8ebf4b9af4dbfd738384d25014e5",
- "_from": "npm-registry-client@1"
+ "_id": "npm-registry-client@2.0.0",
+ "_shasum": "88810dac2d534c0df1d905c79e723392fcfc791a",
+ "_from": "npm-registry-client@2.0.0",
+ "_npmVersion": "1.4.14",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "88810dac2d534c0df1d905c79e723392fcfc791a",
+ "tarball": "http://registry.npmjs.org/npm-registry-client/-/npm-registry-client-2.0.0.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-2.0.0.tgz"
}
diff --git a/node_modules/npm-registry-client/test/00-setup.js b/node_modules/npm-registry-client/test/00-setup.js
index 747768fb8..ae6d03ed3 100644
--- a/node_modules/npm-registry-client/test/00-setup.js
+++ b/node_modules/npm-registry-client/test/00-setup.js
@@ -1,10 +1,10 @@
-var tap = require('tap')
-var rimraf = require('rimraf')
+var tap = require("tap")
+var rimraf = require("rimraf")
-tap.test('setup', function (t) {
- rimraf(__dirname + '/fixtures/cache', function (er) {
+tap.test("setup", function (t) {
+ rimraf(__dirname + "/fixtures/cache", function (er) {
if (er) throw er
- t.pass('cache cleaned')
+ t.pass("cache cleaned")
t.end()
})
})
diff --git a/node_modules/npm-registry-client/test/adduser-new.js b/node_modules/npm-registry-client/test/adduser-new.js
index 96dfc26d1..6cedf94d1 100644
--- a/node_modules/npm-registry-client/test/adduser-new.js
+++ b/node_modules/npm-registry-client/test/adduser-new.js
@@ -1,26 +1,21 @@
-var tap = require('tap')
-var server = require('./fixtures/server.js')
-var RC = require('../')
-var client = new RC({
- cache: __dirname + '/fixtures/cache'
- , registry: 'http://localhost:' + server.port })
+var tap = require("tap")
-var userdata =
-{ name: 'username',
- email: 'i@izs.me',
- _id: 'org.couchdb.user:username',
- type: 'user',
- roles: [],
- date: '2012-06-07T04:11:21.591Z' }
-, password = "password"
-, username = "username"
-, crypto = require("crypto")
-, SD = require('string_decoder').StringDecoder
-, decoder = new SD
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient()
-function sha (s) {
- return crypto.createHash("sha1").update(s).digest("hex")
-}
+var password = "password"
+, username = "username"
+, email = "i@izs.me"
+, userdata = {
+ name: username,
+ email: email,
+ _id: "org.couchdb.user:username",
+ type: "user",
+ roles: [],
+ date: "2012-06-07T04:11:21.591Z" }
+, SD = require("string_decoder").StringDecoder
+, decoder = new SD()
tap.test("create new user account", function (t) {
server.expect("/-/user/org.couchdb.user:username", function (req, res) {
@@ -41,7 +36,7 @@ tap.test("create new user account", function (t) {
})
})
- client.adduser(username, password, "i@izs.me", function (er, data, raw, res) {
+ client.adduser("http://localhost:1337/", username, password, email, function (er, data) {
if (er) throw er
t.deepEqual(data, { created: true })
t.end()
diff --git a/node_modules/npm-registry-client/test/adduser-update.js b/node_modules/npm-registry-client/test/adduser-update.js
index 370457147..551c9843e 100644
--- a/node_modules/npm-registry-client/test/adduser-update.js
+++ b/node_modules/npm-registry-client/test/adduser-update.js
@@ -1,29 +1,22 @@
-var tap = require('tap')
-var server = require('./fixtures/server.js')
-var RC = require('../')
-var client = new RC({
- cache: __dirname + '/fixtures/cache'
- , registry: 'http://localhost:' + server.port })
+var tap = require("tap")
-var userdata =
-{ name: 'username',
- email: 'i@izs.me',
- _id: 'org.couchdb.user:username',
- type: 'user',
- roles: [],
- _rev: "1-15aac515ac515aac515aac515aac5125"
-}
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient()
-, password = "password"
+var password = "password"
, username = "username"
-, crypto = require("crypto")
-, SD = require('string_decoder').StringDecoder
-, decoder = new SD
-
+, email = "i@izs.me"
+, userdata = {
+ name: username,
+ email: email,
+ _id: "org.couchdb.user:username",
+ type: "user",
+ roles: [],
+ date: "2012-06-07T04:11:21.591Z" }
+, SD = require("string_decoder").StringDecoder
+, decoder = new SD()
-function sha (s) {
- return crypto.createHash("sha1").update(s).digest("hex")
-}
tap.test("update a user acct", function (t) {
server.expect("PUT", "/-/user/org.couchdb.user:username", function (req, res) {
@@ -56,9 +49,7 @@ tap.test("update a user acct", function (t) {
})
})
-
-
- client.adduser(username, password, "i@izs.me", function (er, data, raw, res) {
+ client.adduser("http://localhost:1337/", username, password, email, function (er, data) {
if (er) throw er
t.deepEqual(data, { created: true })
t.end()
diff --git a/node_modules/npm-registry-client/test/basic.js b/node_modules/npm-registry-client/test/basic.js
deleted file mode 100644
index 022466aee..000000000
--- a/node_modules/npm-registry-client/test/basic.js
+++ /dev/null
@@ -1,32 +0,0 @@
-var tap = require('tap')
-var server = require('./fixtures/server.js')
-var RC = require('../')
-var rimraf = require("rimraf")
-var client = new RC({
- cache: __dirname + '/fixtures/cache'
- , registry: 'http://localhost:' + server.port })
-var us = require('./fixtures/underscore/1.3.3/cache.json')
-var usroot = require("./fixtures/underscore/cache.json")
-
-tap.test("basic request", function (t) {
- server.expect("/underscore/1.3.3", function (req, res) {
- console.error('got a request')
- res.json(us)
- })
-
- server.expect("/underscore", function (req, res) {
- console.error('got a request')
- res.json(usroot)
- })
-
- t.plan(2)
- client.get("/underscore/1.3.3", function (er, data, raw, res) {
- console.error("got response")
- t.deepEqual(data, us)
- })
-
- client.get("/underscore", function (er, data, raw, res) {
- console.error("got response")
- t.deepEqual(data, usroot)
- })
-})
diff --git a/node_modules/npm-registry-client/test/bugs.js b/node_modules/npm-registry-client/test/bugs.js
new file mode 100644
index 000000000..092ec9f79
--- /dev/null
+++ b/node_modules/npm-registry-client/test/bugs.js
@@ -0,0 +1,33 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username : "username",
+ password : "password",
+ email : "ogd@aoaioxxysz.net",
+ _auth : new Buffer("username : password").toString("base64"),
+ "always-auth" : true
+})
+
+tap.test("get the URL for the bugs page on a package", function (t) {
+ server.expect("GET", "/sample/latest", function (req, res) {
+ t.equal(req.method, "GET")
+
+ res.json({
+ bugs : {
+ url : "http://github.com/example/sample/issues",
+ email : "sample@example.com"
+ }
+ })
+ })
+
+ client.bugs("http://localhost:1337/sample", function (error, info) {
+ t.notOk(error, "no errors")
+ t.ok(info.url, "got the URL")
+ t.ok(info.email, "got the email address")
+
+ t.end()
+ })
+})
+
diff --git a/node_modules/npm-registry-client/test/deprecate.js b/node_modules/npm-registry-client/test/deprecate.js
new file mode 100644
index 000000000..52c21b2f8
--- /dev/null
+++ b/node_modules/npm-registry-client/test/deprecate.js
@@ -0,0 +1,66 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username : "username",
+ password : "password",
+ email : "ogd@aoaioxxysz.net",
+ _auth : new Buffer("username : password").toString("base64"),
+ "always-auth" : true
+})
+
+var cache = require("./fixtures/underscore/cache.json")
+
+var VERSION = "1.3.2"
+var MESSAGE = "uhhh"
+
+tap.test("deprecate a package", function (t) {
+ server.expect("GET", "/underscore?write=true", function (req, res) {
+ t.equal(req.method, "GET")
+
+ res.json(cache)
+ })
+
+ server.expect("PUT", "/underscore", function (req, res) {
+ t.equal(req.method, "PUT")
+
+ var b = ""
+ req.setEncoding("utf8")
+ req.on("data", function (d) {
+ b += d
+ })
+
+ req.on("end", function () {
+ var updated = JSON.parse(b)
+
+ var undeprecated = [
+ "1.0.3", "1.0.4", "1.1.0", "1.1.1", "1.1.2", "1.1.3", "1.1.4", "1.1.5", "1.1.6",
+ "1.1.7", "1.2.0", "1.2.1", "1.2.2", "1.2.3", "1.2.4", "1.3.0", "1.3.1", "1.3.3"
+ ]
+ for (var i = 0; i < undeprecated.length; i++) {
+ var current = undeprecated[i]
+ t.notEqual(
+ updated.versions[current].deprecated,
+ MESSAGE,
+ current + " not deprecated"
+ )
+ }
+
+ t.equal(
+ updated.versions[VERSION].deprecated,
+ MESSAGE,
+ VERSION + " deprecated"
+ )
+ res.statusCode = 201
+ res.json({deprecated:true})
+ })
+ })
+
+ client.deprecate("http://localhost:1337/underscore", VERSION, MESSAGE, function (error, data) {
+ t.notOk(error, "no errors")
+ t.ok(data.deprecated, "was deprecated")
+
+ t.end()
+ })
+})
diff --git a/node_modules/npm-registry-client/test/get-all.js b/node_modules/npm-registry-client/test/get-all.js
new file mode 100644
index 000000000..86978b267
--- /dev/null
+++ b/node_modules/npm-registry-client/test/get-all.js
@@ -0,0 +1,16 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient()
+
+tap.test("basic request", function (t) {
+ server.expect("/-/all", function (req, res) {
+ res.json([])
+ })
+
+ client.get("http://localhost:1337/-/all", null, function (er) {
+ t.notOk(er, "no error")
+ t.end()
+ })
+})
diff --git a/node_modules/npm-registry-client/test/get-basic.js b/node_modules/npm-registry-client/test/get-basic.js
new file mode 100644
index 000000000..10c48b0b8
--- /dev/null
+++ b/node_modules/npm-registry-client/test/get-basic.js
@@ -0,0 +1,27 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient()
+
+var us = require("./fixtures/underscore/1.3.3/cache.json")
+var usroot = require("./fixtures/underscore/cache.json")
+
+tap.test("basic request", function (t) {
+ server.expect("/underscore/1.3.3", function (req, res) {
+ res.json(us)
+ })
+
+ server.expect("/underscore", function (req, res) {
+ res.json(usroot)
+ })
+
+ t.plan(2)
+ client.get("http://localhost:1337/underscore/1.3.3", null, function (er, data) {
+ t.deepEqual(data, us)
+ })
+
+ client.get("http://localhost:1337/underscore", null, function (er, data) {
+ t.deepEqual(data, usroot)
+ })
+})
diff --git a/node_modules/npm-registry-client/test/lib/common.js b/node_modules/npm-registry-client/test/lib/common.js
new file mode 100644
index 000000000..f9048c094
--- /dev/null
+++ b/node_modules/npm-registry-client/test/lib/common.js
@@ -0,0 +1,17 @@
+var resolve = require("path").resolve
+var server = require('./server.js')
+var RC = require('../../')
+
+module.exports = {
+ freshClient : function freshClient(config) {
+ config = config || {}
+ config.cache = resolve(__dirname, '../fixtures/cache')
+ config.registry = 'http://localhost:' + server.port
+
+ var client = new RC(config)
+ server.log = client.log
+ client.log.level = 'silent'
+
+ return client
+ }
+}
diff --git a/node_modules/npm-registry-client/test/lib/server.js b/node_modules/npm-registry-client/test/lib/server.js
new file mode 100644
index 000000000..03d3cd1fc
--- /dev/null
+++ b/node_modules/npm-registry-client/test/lib/server.js
@@ -0,0 +1,58 @@
+// a fake registry server.
+
+var http = require('http')
+var server = http.createServer(handler)
+var port = server.port = process.env.PORT || 1337
+server.listen(port)
+
+module.exports = server
+
+server._expect = {}
+
+function handler (req, res) {
+ req.connection.setTimeout(1000)
+
+ var u = '* ' + req.url
+ , mu = req.method + ' ' + req.url
+
+ var k = server._expect[mu] ? mu : server._expect[u] ? u : null
+ if (!k) throw Error('unexpected request: ' + req.method + ' ' + req.url)
+
+ var fn = server._expect[k].shift()
+ if (!fn) throw Error('unexpected request' + req.method + ' ' + req.url)
+
+
+ var remain = (Object.keys(server._expect).reduce(function (s, k) {
+ return s + server._expect[k].length
+ }, 0))
+ if (remain === 0) server.close()
+ else this.log.info("fake-registry", "TEST SERVER: %d reqs remain", remain)
+ this.log.info("fake-registry", Object.keys(server._expect).map(function(k) {
+ return [k, server._expect[k].length]
+ }).reduce(function (acc, kv) {
+ acc[kv[0]] = kv[1]
+ return acc
+ }, {}))
+
+ res.json = json
+ fn(req, res)
+}
+
+function json (o) {
+ this.setHeader('content-type', 'application/json')
+ this.end(JSON.stringify(o))
+}
+
+// this log is meanto to be overridden
+server.log = require("npmlog")
+
+server.expect = function (method, u, fn) {
+ if (typeof u === 'function') {
+ fn = u
+ u = method
+ method = '*'
+ }
+ u = method + ' ' + u
+ server._expect[u] = server._expect[u] || []
+ server._expect[u].push(fn)
+}
diff --git a/node_modules/npm-registry-client/test/publish-again.js b/node_modules/npm-registry-client/test/publish-again.js
index 011fbaf5a..af59980b3 100644
--- a/node_modules/npm-registry-client/test/publish-again.js
+++ b/node_modules/npm-registry-client/test/publish-again.js
@@ -1,24 +1,22 @@
-var tap = require('tap')
-var server = require('./fixtures/server.js')
-var RC = require('../')
-var client = new RC(
- { cache: __dirname + '/fixtures/cache'
- , registry: 'http://localhost:' + server.port
- , username: "username"
- , password: "password"
- , email: "i@izs.me"
- , _auth: new Buffer("username:password").toString('base64')
- , "always-auth": true
- })
-
+var tap = require("tap")
var fs = require("fs")
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username: "username",
+ password: "password",
+ email: "i@izs.me",
+ _auth: new Buffer("username:password").toString("base64"),
+ "always-auth": true
+})
+
tap.test("publish again", function (t) {
var lastTime = null
server.expect("/npm-registry-client", function (req, res) {
t.equal(req.method, "PUT")
var b = ""
- req.setEncoding('utf8')
+ req.setEncoding("utf8")
req.on("data", function (d) {
b += d
})
@@ -28,8 +26,8 @@ tap.test("publish again", function (t) {
t.equal(o._id, "npm-registry-client")
t.equal(o["dist-tags"].latest, pkg.version)
t.has(o.versions[pkg.version], pkg)
- t.same(o.maintainers, [ { name: 'username', email: 'i@izs.me' } ])
- var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ]
+ t.same(o.maintainers, [ { name: "username", email: "i@izs.me" } ])
+ var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ]
t.same(att.data, pd)
res.statusCode = 409
res.json({reason: "must supply latest _rev to update existing package"})
@@ -54,7 +52,7 @@ tap.test("publish again", function (t) {
t.ok(lastTime)
var b = ""
- req.setEncoding('utf8')
+ req.setEncoding("utf8")
req.on("data", function (d) {
b += d
})
@@ -70,10 +68,10 @@ tap.test("publish again", function (t) {
// not really a tarball, but doesn't matter
- var tarball = require.resolve('../package.json')
- var pd = fs.readFileSync(tarball, 'base64')
- var pkg = require('../package.json')
- client.publish(pkg, tarball, function (er, data, raw, res) {
+ var tarball = require.resolve("../package.json")
+ var pd = fs.readFileSync(tarball, "base64")
+ var pkg = require("../package.json")
+ client.publish("http://localhost:1337/", pkg, tarball, function (er, data) {
if (er) throw er
t.deepEqual(data, { created: true })
t.end()
diff --git a/node_modules/npm-registry-client/test/publish.js b/node_modules/npm-registry-client/test/publish.js
index 9dcfc3374..a6233905f 100644
--- a/node_modules/npm-registry-client/test/publish.js
+++ b/node_modules/npm-registry-client/test/publish.js
@@ -1,24 +1,23 @@
-var tap = require('tap')
-var crypto = require('crypto')
-var server = require('./fixtures/server.js')
-var RC = require('../')
-var client = new RC(
- { cache: __dirname + '/fixtures/cache'
- , registry: 'http://localhost:' + server.port
- , username: "username"
- , password: "password"
- , email: "i@izs.me"
- , _auth: new Buffer("username:password").toString('base64')
- , "always-auth": true
- })
-
+var tap = require("tap")
+var crypto = require("crypto")
var fs = require("fs")
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username: "username",
+ password: "password",
+ email: "i@izs.me",
+ _auth: new Buffer("username:password").toString("base64"),
+ "always-auth": true
+})
+
+
tap.test("publish", function (t) {
server.expect("/npm-registry-client", function (req, res) {
t.equal(req.method, "PUT")
var b = ""
- req.setEncoding('utf8')
+ req.setEncoding("utf8")
req.on("data", function (d) {
b += d
})
@@ -28,11 +27,11 @@ tap.test("publish", function (t) {
t.equal(o._id, "npm-registry-client")
t.equal(o["dist-tags"].latest, pkg.version)
t.has(o.versions[pkg.version], pkg)
- t.same(o.maintainers, [ { name: 'username', email: 'i@izs.me' } ])
+ t.same(o.maintainers, [ { name: "username", email: "i@izs.me" } ])
t.same(o.maintainers, o.versions[pkg.version].maintainers)
- var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ]
+ var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ]
t.same(att.data, pd)
- var hash = crypto.createHash('sha1').update(pd, 'base64').digest('hex')
+ var hash = crypto.createHash("sha1").update(pd, "base64").digest("hex")
t.equal(o.versions[pkg.version].dist.shasum, hash)
res.statusCode = 201
res.json({created:true})
@@ -40,10 +39,10 @@ tap.test("publish", function (t) {
})
// not really a tarball, but doesn't matter
- var tarball = require.resolve('../package.json')
- var pd = fs.readFileSync(tarball, 'base64')
- var pkg = require('../package.json')
- client.publish(pkg, tarball, function (er, data, raw, res) {
+ var tarball = require.resolve("../package.json")
+ var pd = fs.readFileSync(tarball, "base64")
+ var pkg = require("../package.json")
+ client.publish("http://localhost:1337/", pkg, tarball, function (er, data) {
if (er) throw er
t.deepEqual(data, { created: true })
t.end()
diff --git a/node_modules/npm-registry-client/test/request-gzip-content.js b/node_modules/npm-registry-client/test/request-gzip-content.js
index 2c7dcae59..79c2e8dc0 100644
--- a/node_modules/npm-registry-client/test/request-gzip-content.js
+++ b/node_modules/npm-registry-client/test/request-gzip-content.js
@@ -1,45 +1,47 @@
-var zlib = require('zlib')
-var tap = require('tap')
-var server = require('./fixtures/server.js')
-var RC = require('../')
+var zlib = require("zlib")
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ "fetch-retries" : 1,
+ "fetch-retry-mintimeout" : 10,
+ "fetch-retry-maxtimeout" : 100
+})
+
+var TEST_URL = "http://localhost:1337/some-package-gzip/1.2.3"
+
var pkg = {
- _id: 'some-package-gzip@1.2.3',
- name: 'some-package-gzip',
- version: '1.2.3'
+ _id: "some-package-gzip@1.2.3",
+ name: "some-package-gzip",
+ version: "1.2.3"
}
zlib.gzip(JSON.stringify(pkg), function (err, pkgGzip) {
- var client = new RC({
- cache: __dirname + '/fixtures/cache'
- , 'fetch-retries': 1
- , 'fetch-retry-mintimeout': 10
- , 'fetch-retry-maxtimeout': 100
- , registry: 'http://localhost:' + server.port })
-
- tap.test('request gzip package content', function (t) {
- server.expect('GET', '/some-package-gzip/1.2.3', function (req, res) {
+ tap.test("request gzip package content", function (t) {
+ server.expect("GET", "/some-package-gzip/1.2.3", function (req, res) {
res.statusCode = 200
- res.setHeader('Content-Encoding', 'gzip');
- res.setHeader('Content-Type', 'application/json');
+ res.setHeader("Content-Encoding", "gzip");
+ res.setHeader("Content-Type", "application/json");
res.end(pkgGzip)
})
- client.get('/some-package-gzip/1.2.3', function (er, data, raw, res) {
+ client.get(TEST_URL, null, function (er, data) {
if (er) throw er
t.deepEqual(data, pkg)
t.end()
})
})
- tap.test('request wrong gzip package content', function (t) {
- server.expect('GET', '/some-package-gzip-error/1.2.3', function (req, res) {
+ tap.test("request wrong gzip package content", function (t) {
+ server.expect("GET", "/some-package-gzip-error/1.2.3", function (req, res) {
res.statusCode = 200
- res.setHeader('Content-Encoding', 'gzip')
- res.setHeader('Content-Type', 'application/json')
- res.end(new Buffer('wrong gzip content'))
+ res.setHeader("Content-Encoding", "gzip")
+ res.setHeader("Content-Type", "application/json")
+ res.end(new Buffer("wrong gzip content"))
})
- client.get('/some-package-gzip-error/1.2.3', function (er, data, raw, res) {
+ client.get(TEST_URL, null, function (er) {
t.ok(er)
t.end()
})
diff --git a/node_modules/npm-registry-client/test/retries.js b/node_modules/npm-registry-client/test/retries.js
index 8f0e63f72..f30f68080 100644
--- a/node_modules/npm-registry-client/test/retries.js
+++ b/node_modules/npm-registry-client/test/retries.js
@@ -1,44 +1,47 @@
-var tap = require('tap')
-var server = require('./fixtures/server.js')
-var RC = require('../')
-var pkg = { _id: 'some-package@1.2.3',
- name: 'some-package',
- version: '1.2.3' }
-var client = new RC({
- 'fetch-retries': 6
- , 'fetch-retry-mintimeout': 10
- , 'fetch-retry-maxtimeout': 100
- , cache: __dirname + '/fixtures/cache'
- , registry: 'http://localhost:' + server.port })
+var tap = require("tap")
-tap.test('create new user account', function (t) {
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ "fetch-retries": 6,
+ "fetch-retry-mintimeout": 10,
+ "fetch-retry-maxtimeout": 100
+})
+
+var pkg = {
+ _id : "some-package@1.2.3",
+ name : "some-package",
+ version : "1.2.3"
+}
+
+tap.test("create new user account", function (t) {
// first time, return a 408
- server.expect('GET', '/some-package/1.2.3', function (req, res) {
+ server.expect("GET", "/some-package/1.2.3", function (req, res) {
res.statusCode = 408
- res.end('Timeout')
+ res.end("Timeout")
})
// then, slam the door in their face
- server.expect('GET', '/some-package/1.2.3', function (req, res) {
+ server.expect("GET", "/some-package/1.2.3", function (req, res) {
res.destroy()
})
// then, blame someone else
- server.expect('GET', '/some-package/1.2.3', function (req, res) {
+ server.expect("GET", "/some-package/1.2.3", function (req, res) {
res.statusCode = 502
- res.end('Gateway Timeout')
+ res.end("Gateway Timeout")
})
// 'No one's home right now, come back later'
- server.expect('GET', '/some-package/1.2.3', function (req, res) {
+ server.expect("GET", "/some-package/1.2.3", function (req, res) {
res.statusCode = 503
- res.setHeader('retry-after', '10')
- res.end('Come back later')
+ res.setHeader("retry-after", "10")
+ res.end("Come back later")
})
// finally, you may enter.
- server.expect('GET', '/some-package/1.2.3', function (req, res) {
+ server.expect("GET", "/some-package/1.2.3", function (req, res) {
res.statusCode = 200
res.json(pkg)
})
- client.get('/some-package/1.2.3', function (er, data, raw, res) {
+ client.get("http://localhost:1337/some-package/1.2.3", null, function (er, data) {
if (er) throw er
t.deepEqual(data, pkg)
t.end()
diff --git a/node_modules/npm-registry-client/test/star.js b/node_modules/npm-registry-client/test/star.js
new file mode 100644
index 000000000..3e140aae8
--- /dev/null
+++ b/node_modules/npm-registry-client/test/star.js
@@ -0,0 +1,60 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username : "othiym23",
+ password : "password",
+ email : "ogd@aoaioxxysz.net",
+ _auth : new Buffer("username : password").toString("base64"),
+ "always-auth" : true
+})
+
+var cache = require("./fixtures/underscore/cache.json")
+
+var DEP_USER = "othiym23"
+
+tap.test("star a package", function (t) {
+ server.expect("GET", "/underscore?write=true", function (req, res) {
+ t.equal(req.method, "GET")
+
+ res.json(cache)
+ })
+
+ server.expect("PUT", "/underscore", function (req, res) {
+ t.equal(req.method, "PUT")
+
+ var b = ""
+ req.setEncoding("utf8")
+ req.on("data", function (d) {
+ b += d
+ })
+
+ req.on("end", function () {
+ var updated = JSON.parse(b)
+
+ var already = [
+ "vesln", "mvolkmann", "lancehunt", "mikl", "linus", "vasc", "bat",
+ "dmalam", "mbrevoort", "danielr", "rsimoes", "thlorenz"
+ ]
+ for (var i = 0; i < already.length; i++) {
+ var current = already[i]
+ t.ok(
+ updated.users[current],
+ current + " still likes this package"
+ )
+ }
+ t.ok(updated.users[DEP_USER], "user is in the starred list")
+
+ res.statusCode = 201
+ res.json({starred:true})
+ })
+ })
+
+ client.star("http://localhost:1337/underscore", true, function (error, data) {
+ t.notOk(error, "no errors")
+ t.ok(data.starred, "was starred")
+
+ t.end()
+ })
+})
diff --git a/node_modules/npm-registry-client/test/stars.js b/node_modules/npm-registry-client/test/stars.js
new file mode 100644
index 000000000..64835c02a
--- /dev/null
+++ b/node_modules/npm-registry-client/test/stars.js
@@ -0,0 +1,32 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username : "username",
+ password : "password",
+ email : "ogd@aoaioxxysz.net",
+ _auth : new Buffer("username : password").toString("base64"),
+ "always-auth" : true
+})
+
+var users = [
+ "benjamincoe",
+ "seldo",
+ "ceejbot"
+]
+
+tap.test("get the URL for the bugs page on a package", function (t) {
+ server.expect("GET", "/-/_view/starredByUser?key=%22sample%22", function (req, res) {
+ t.equal(req.method, "GET")
+
+ res.json(users)
+ })
+
+ client.stars("http://localhost:1337/", "sample", function (error, info) {
+ t.notOk(error, "no errors")
+ t.deepEqual(info, users, "got the list of users")
+
+ t.end()
+ })
+})
diff --git a/node_modules/npm-registry-client/test/tag.js b/node_modules/npm-registry-client/test/tag.js
new file mode 100644
index 000000000..b8b8e1927
--- /dev/null
+++ b/node_modules/npm-registry-client/test/tag.js
@@ -0,0 +1,39 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username : "username",
+ password : "password",
+ email : "ogd@aoaioxxysz.net",
+ _auth : new Buffer("username : password").toString("base64"),
+ "always-auth" : true
+})
+
+tap.test("tag a package", function (t) {
+ server.expect("PUT", "/underscore/not-lodash", function (req, res) {
+ t.equal(req.method, "PUT")
+
+ var b = ""
+ req.setEncoding("utf8")
+ req.on("data", function (d) {
+ b += d
+ })
+
+ req.on("end", function () {
+ var updated = JSON.parse(b)
+
+ t.deepEqual(updated, {"1.3.2":{}})
+
+ res.statusCode = 201
+ res.json({tagged:true})
+ })
+ })
+
+ client.tag("http://localhost:1337/underscore", {"1.3.2":{}}, "not-lodash", function (error, data) {
+ t.notOk(error, "no errors")
+ t.ok(data.tagged, "was tagged")
+
+ t.end()
+ })
+})
diff --git a/node_modules/npm-registry-client/test/unpublish.js b/node_modules/npm-registry-client/test/unpublish.js
new file mode 100644
index 000000000..e8a209306
--- /dev/null
+++ b/node_modules/npm-registry-client/test/unpublish.js
@@ -0,0 +1,59 @@
+var tap = require("tap")
+
+var server = require("./lib/server.js")
+var common = require("./lib/common.js")
+var client = common.freshClient({
+ username : "othiym23",
+ password : "password",
+ email : "ogd@aoaioxxysz.net",
+ _auth : new Buffer("username : password").toString("base64"),
+ "always-auth" : true
+})
+
+var cache = require("./fixtures/underscore/cache.json")
+
+var REV = "/-rev/72-47f2986bfd8e8b55068b204588bbf484"
+var VERSION = "1.3.2"
+
+tap.test("unpublish a package", function (t) {
+ server.expect("GET", "/underscore?write=true", function (req, res) {
+ t.equal(req.method, "GET")
+
+ res.json(cache)
+ })
+
+ server.expect("PUT", "/underscore" + REV, function (req, res) {
+ t.equal(req.method, "PUT")
+
+ var b = ""
+ req.setEncoding("utf-8")
+ req.on("data", function (d) {
+ b += d
+ })
+
+ req.on("end", function () {
+ var updated = JSON.parse(b)
+ t.notOk(updated.versions[VERSION])
+ })
+
+ res.json(cache)
+ })
+
+ server.expect("GET", "/underscore", function (req, res) {
+ t.equal(req.method, "GET")
+
+ res.json(cache)
+ })
+
+ server.expect("DELETE", "/underscore/-/underscore-1.3.2.tgz" + REV, function (req, res) {
+ t.equal(req.method, "DELETE")
+
+ res.json({unpublished:true})
+ })
+
+ client.unpublish("http://localhost:1337/underscore", VERSION, function (error) {
+ t.notOk(error, "no errors")
+
+ t.end()
+ })
+})
diff --git a/node_modules/npm-registry-client/test/upload.js b/node_modules/npm-registry-client/test/upload.js
new file mode 100644
index 000000000..8884db8f3
--- /dev/null
+++ b/node_modules/npm-registry-client/test/upload.js
@@ -0,0 +1,37 @@
+var tap = require("tap")
+var Readable = require("stream").Readable
+var inherits = require("util").inherits
+
+var common = require("./lib/common.js")
+var server = require("./lib/server.js")
+
+var cache = require("./fixtures/underscore/cache.json")
+
+var client = common.freshClient({
+ username : "othiym23",
+ password : "password",
+ email : "ogd@aoaioxxysz.net",
+ _auth : new Buffer("username : password").toString("base64"),
+ "always-auth" : true
+})
+
+function OneA() {
+ Readable.call(this)
+ this.push("A")
+ this.push(null)
+}
+inherits(OneA, Readable)
+
+tap.test("unpublish a package", function (t) {
+ server.expect("PUT", "/underscore", function (req, res) {
+ t.equal(req.method, "PUT")
+
+ res.json(cache)
+ })
+
+ client.upload("http://localhost:1337/underscore", new OneA(), "daedabeefa", true, function (error) {
+ t.notOk(error, "no errors")
+
+ t.end()
+ })
+})
diff --git a/node_modules/npm-registry-client/test/zz-cleanup.js b/node_modules/npm-registry-client/test/zz-cleanup.js
index 35253c7ac..f030b11ee 100644
--- a/node_modules/npm-registry-client/test/zz-cleanup.js
+++ b/node_modules/npm-registry-client/test/zz-cleanup.js
@@ -1,10 +1,10 @@
-var tap = require('tap')
-var rimraf = require('rimraf')
+var tap = require("tap")
+var rimraf = require("rimraf")
-tap.test('teardown', function (t) {
- rimraf(__dirname + '/fixtures/cache', function (er) {
+tap.test("teardown", function (t) {
+ rimraf(__dirname + "/fixtures/cache", function (er) {
if (er) throw er
- t.pass('cache cleaned')
+ t.pass("cache cleaned")
t.end()
})
})
diff --git a/package.json b/package.json
index 7587cd96e..7c11c089d 100644
--- a/package.json
+++ b/package.json
@@ -61,7 +61,7 @@
"nopt": "~3.0.0",
"npm-cache-filename": "~1.0.1",
"npm-install-checks": "~1.0.2",
- "npm-registry-client": "1",
+ "npm-registry-client": "~2.0.0",
"npm-user-validate": "~0.1.0",
"npmconf": "~1.0.5",
"npmlog": "~0.1.0",