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:
authorForrest L Norvell <forrest@npmjs.com>2014-10-16 04:11:59 +0400
committerForrest L Norvell <forrest@npmjs.com>2014-10-16 20:19:09 +0400
commit6a14b232a0e34158bd95bb25c607167be995c204 (patch)
treeffaa0dcbec04c002f246dbeb3aeb458e27757826
parent344fa1a219ac8867022df3dc58a47636dde8a242 (diff)
defactored npmconf back into npm
-rw-r--r--.gitignore1
-rwxr-xr-xbin/npm-cli.js2
-rw-r--r--lib/completion.js4
-rw-r--r--lib/config.js10
-rw-r--r--lib/config/core.js (renamed from node_modules/npmconf/npmconf.js)138
-rw-r--r--lib/config/defaults.js (renamed from node_modules/npmconf/config-defs.js)12
-rw-r--r--lib/config/find-prefix.js (renamed from node_modules/npmconf/lib/find-prefix.js)0
-rw-r--r--lib/config/get-credentials-by-uri.js (renamed from node_modules/npmconf/lib/get-credentials-by-uri.js)0
-rw-r--r--lib/config/load-cafile.js (renamed from node_modules/npmconf/lib/load-cafile.js)9
-rw-r--r--lib/config/load-prefix.js (renamed from node_modules/npmconf/lib/load-prefix.js)8
-rw-r--r--lib/config/load-uid.js (renamed from node_modules/npmconf/lib/load-uid.js)0
-rw-r--r--lib/config/nerf-dart.js (renamed from node_modules/npmconf/lib/nerf-dart.js)0
-rw-r--r--lib/config/set-credentials-by-uri.js (renamed from node_modules/npmconf/lib/set-credentials-by-uri.js)0
-rw-r--r--lib/config/set-user.js (renamed from node_modules/npmconf/lib/set-user.js)9
-rw-r--r--lib/npm.js2
-rw-r--r--lib/publish.js2
-rw-r--r--node_modules/config-chain/.npmignore (renamed from node_modules/npmconf/node_modules/config-chain/.npmignore)0
-rw-r--r--node_modules/config-chain/LICENCE (renamed from node_modules/npmconf/node_modules/config-chain/LICENCE)0
-rwxr-xr-xnode_modules/config-chain/index.js (renamed from node_modules/npmconf/node_modules/config-chain/index.js)0
-rw-r--r--node_modules/config-chain/node_modules/proto-list/LICENSE (renamed from node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/LICENSE)0
-rw-r--r--node_modules/config-chain/node_modules/proto-list/README.md (renamed from node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/README.md)0
-rw-r--r--node_modules/config-chain/node_modules/proto-list/package.json (renamed from node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json)2
-rw-r--r--node_modules/config-chain/node_modules/proto-list/proto-list.js (renamed from node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/proto-list.js)0
-rw-r--r--node_modules/config-chain/node_modules/proto-list/test/basic.js (renamed from node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/test/basic.js)0
-rw-r--r--node_modules/config-chain/package.json (renamed from node_modules/npmconf/node_modules/config-chain/package.json)2
-rw-r--r--node_modules/config-chain/readme.markdown (renamed from node_modules/npmconf/node_modules/config-chain/readme.markdown)0
-rw-r--r--node_modules/config-chain/test/broken.js (renamed from node_modules/npmconf/node_modules/config-chain/test/broken.js)0
-rw-r--r--node_modules/config-chain/test/broken.json (renamed from node_modules/npmconf/node_modules/config-chain/test/broken.json)0
-rw-r--r--node_modules/config-chain/test/chain-class.js (renamed from node_modules/npmconf/node_modules/config-chain/test/chain-class.js)0
-rw-r--r--node_modules/config-chain/test/env.js (renamed from node_modules/npmconf/node_modules/config-chain/test/env.js)0
-rw-r--r--node_modules/config-chain/test/find-file.js (renamed from node_modules/npmconf/node_modules/config-chain/test/find-file.js)0
-rw-r--r--node_modules/config-chain/test/get.js (renamed from node_modules/npmconf/node_modules/config-chain/test/get.js)0
-rw-r--r--node_modules/config-chain/test/ignore-unfound-file.js (renamed from node_modules/npmconf/node_modules/config-chain/test/ignore-unfound-file.js)0
-rw-r--r--node_modules/config-chain/test/ini.js (renamed from node_modules/npmconf/node_modules/config-chain/test/ini.js)0
-rw-r--r--node_modules/config-chain/test/save.js (renamed from node_modules/npmconf/node_modules/config-chain/test/save.js)0
-rw-r--r--node_modules/npm-registry-client/package.json13
-rw-r--r--node_modules/npmconf/.npmignore3
-rw-r--r--node_modules/npmconf/LICENSE27
-rw-r--r--node_modules/npmconf/README.md33
-rw-r--r--node_modules/npmconf/package.json53
-rw-r--r--node_modules/npmconf/test/00-setup.js67
-rw-r--r--node_modules/npmconf/test/basic.js58
-rw-r--r--node_modules/npmconf/test/builtin.js59
-rw-r--r--node_modules/npmconf/test/certfile.js17
-rw-r--r--node_modules/npmconf/test/project.js60
-rw-r--r--node_modules/npmconf/test/save.js84
-rw-r--r--node_modules/npmconf/test/semver-tag.js65
-rw-r--r--package.json6
-rw-r--r--test/fixtures/config/.npmrc (renamed from node_modules/npmconf/test/fixtures/.npmrc)0
-rw-r--r--test/fixtures/config/builtin (renamed from node_modules/npmconf/test/fixtures/builtin)0
-rw-r--r--test/fixtures/config/globalconfig (renamed from node_modules/npmconf/test/fixtures/globalconfig)0
-rw-r--r--test/fixtures/config/multi-ca (renamed from node_modules/npmconf/test/fixtures/multi-ca)0
-rw-r--r--test/fixtures/config/package.json (renamed from node_modules/npmconf/test/fixtures/package.json)0
-rw-r--r--test/fixtures/config/userconfig (renamed from node_modules/npmconf/test/fixtures/userconfig)0
-rw-r--r--test/tap/00-config-setup.js67
-rw-r--r--test/tap/config-basic.js66
-rw-r--r--test/tap/config-builtin.js68
-rw-r--r--test/tap/config-certfile.js18
-rw-r--r--test/tap/config-credentials.js (renamed from node_modules/npmconf/test/credentials.js)14
-rw-r--r--test/tap/config-meta.js2
-rw-r--r--test/tap/config-project.js66
-rw-r--r--test/tap/config-save.js88
-rw-r--r--test/tap/config-semver-tag.js27
63 files changed, 517 insertions, 645 deletions
diff --git a/.gitignore b/.gitignore
index 137a452bf..7bb9c6687 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@ npm-debug.log
/release/
/npm-*.tgz
/node_modules/npm-registry-client/test/fixtures
+/test/fixtures/config/userconfig-with-gc
/node_modules/npm-registry-couchapp
*.pyc
.jshintrc
diff --git a/bin/npm-cli.js b/bin/npm-cli.js
index ed81a989a..ace40ca79 100755
--- a/bin/npm-cli.js
+++ b/bin/npm-cli.js
@@ -21,7 +21,7 @@ log.info("it worked if it ends with", "ok")
var path = require("path")
, npm = require("../lib/npm.js")
- , npmconf = require("npmconf")
+ , npmconf = require("../lib/config/core.js")
, errorHandler = require("../lib/utils/error-handler.js")
, configDefs = npmconf.defs
diff --git a/lib/completion.js b/lib/completion.js
index 5c1098a59..1d26ffcf8 100644
--- a/lib/completion.js
+++ b/lib/completion.js
@@ -6,7 +6,7 @@ completion.usage = "npm completion >> ~/.bashrc\n"
+ "source <(npm completion)"
var npm = require("./npm.js")
- , npmconf = require("npmconf")
+ , npmconf = require("./config/core.js")
, configDefs = npmconf.defs
, configTypes = configDefs.types
, shorthands = configDefs.shorthands
@@ -229,7 +229,7 @@ function configCompl (opts, cb) {
// expand with the valid values of various config values.
// not yet implemented.
function configValueCompl (opts, cb) {
- console.error('configValue', opts)
+ console.error("configValue", opts)
return cb(null, [])
}
diff --git a/lib/config.js b/lib/config.js
index 6a45e8a02..f51156aad 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -11,9 +11,9 @@ config.usage = "npm config set <key> <value>"
var log = require("npmlog")
, npm = require("./npm.js")
+ , npmconf = require("./config/core.js")
, fs = require("graceful-fs")
, writeFileAtomic = require("write-file-atomic")
- , npmconf = require("npmconf")
, types = npmconf.defs.types
, ini = require("ini")
, editor = require("editor")
@@ -89,10 +89,10 @@ function edit (cb) {
if (key === "logstream") return arr
return arr.concat(
ini.stringify(obj)
- .replace(/\n$/m, '')
- .replace(/^/g, '; ')
- .replace(/\n/g, '\n; ')
- .split('\n'))
+ .replace(/\n$/m, "")
+ .replace(/^/g, "; ")
+ .replace(/\n/g, "\n; ")
+ .split("\n"))
}, []))
.concat([""])
.join(os.EOL)
diff --git a/node_modules/npmconf/npmconf.js b/lib/config/core.js
index 7607b50f8..c1ccf6089 100644
--- a/node_modules/npmconf/npmconf.js
+++ b/lib/config/core.js
@@ -1,15 +1,15 @@
-var CC = require('config-chain').ConfigChain
-var inherits = require('inherits')
-var configDefs = require('./config-defs.js')
+var CC = require("config-chain").ConfigChain
+var inherits = require("inherits")
+var configDefs = require("./defaults.js")
var types = configDefs.types
-var once = require('once')
-var fs = require('fs')
-var path = require('path')
-var nopt = require('nopt')
-var ini = require('ini')
+var once = require("once")
+var fs = require("fs")
+var path = require("path")
+var nopt = require("nopt")
+var ini = require("ini")
var Octal = configDefs.Octal
-var mkdirp = require('mkdirp')
+var mkdirp = require("mkdirp")
exports.load = load
exports.Conf = Conf
@@ -18,11 +18,11 @@ exports.rootConf = null
exports.usingBuiltin = false
exports.defs = configDefs
-Object.defineProperty(exports, 'defaults', { get: function () {
+Object.defineProperty(exports, "defaults", { get: function () {
return configDefs.defaults
}, enumerable: true })
-Object.defineProperty(exports, 'types', { get: function () {
+Object.defineProperty(exports, "types", { get: function () {
return configDefs.types
}, enumerable: true })
@@ -40,9 +40,9 @@ function load (cli_, builtin_, cb_) {
var cli, builtin, cb
for (var i = 0; i < arguments.length; i++)
switch (typeof arguments[i]) {
- case 'string': builtin = arguments[i]; break
- case 'object': cli = arguments[i]; break
- case 'function': cb = arguments[i]; break
+ case "string": builtin = arguments[i]; break
+ case "object": cli = arguments[i]; break
+ case "function": cb = arguments[i]; break
}
if (!cb)
@@ -85,11 +85,11 @@ function load (cli_, builtin_, cb_) {
exports.usingBuiltin = !!builtin
var rc = exports.rootConf = new Conf()
if (builtin)
- rc.addFile(builtin, 'builtin')
+ rc.addFile(builtin, "builtin")
else
- rc.add({}, 'builtin')
+ rc.add({}, "builtin")
- rc.on('load', function () {
+ rc.on("load", function () {
load_(builtin, rc, cli, cb)
})
}
@@ -99,7 +99,7 @@ function load_(builtin, rc, cli, cb) {
var conf = new Conf(rc)
conf.usingBuiltin = !!builtin
- conf.add(cli, 'cli')
+ conf.add(cli, "cli")
conf.addEnv()
conf.loadPrefix(function(er) {
@@ -122,24 +122,24 @@ function load_(builtin, rc, cli, cb) {
// the default or resolved userconfig value. npm will log a "verbose"
// message about this when it happens, but it is a rare enough edge case
// that we don't have to be super concerned about it.
- var projectConf = path.resolve(conf.localPrefix, '.npmrc')
- var defaultUserConfig = rc.get('userconfig')
- var resolvedUserConfig = conf.get('userconfig')
- if (!conf.get('global') &&
+ var projectConf = path.resolve(conf.localPrefix, ".npmrc")
+ var defaultUserConfig = rc.get("userconfig")
+ var resolvedUserConfig = conf.get("userconfig")
+ if (!conf.get("global") &&
projectConf !== defaultUserConfig &&
projectConf !== resolvedUserConfig) {
- conf.addFile(projectConf, 'project')
- conf.once('load', afterPrefix)
+ conf.addFile(projectConf, "project")
+ conf.once("load", afterPrefix)
} else {
- conf.add({}, 'project')
+ conf.add({}, "project")
afterPrefix()
}
})
function afterPrefix() {
- conf.addFile(conf.get('userconfig'), 'user')
- conf.once('error', cb)
- conf.once('load', afterUser)
+ conf.addFile(conf.get("userconfig"), "user")
+ conf.once("error", cb)
+ conf.once("load", afterUser)
}
function afterUser () {
@@ -148,18 +148,18 @@ function load_(builtin, rc, cli, cb) {
// Eg, `npm config get globalconfig --prefix ~/local` should
// return `~/local/etc/npmrc`
// annoying humans and their expectations!
- if (conf.get('prefix')) {
- var etc = path.resolve(conf.get('prefix'), 'etc')
- defaults.globalconfig = path.resolve(etc, 'npmrc')
- defaults.globalignorefile = path.resolve(etc, 'npmignore')
+ if (conf.get("prefix")) {
+ var etc = path.resolve(conf.get("prefix"), "etc")
+ defaults.globalconfig = path.resolve(etc, "npmrc")
+ defaults.globalignorefile = path.resolve(etc, "npmignore")
}
- conf.addFile(conf.get('globalconfig'), 'global')
+ conf.addFile(conf.get("globalconfig"), "global")
// move the builtin into the conf stack now.
conf.root = defaults
- conf.add(rc.shift(), 'builtin')
- conf.once('load', function () {
+ conf.add(rc.shift(), "builtin")
+ conf.once("load", function () {
conf.loadExtras(afterExtras)
})
}
@@ -171,7 +171,7 @@ function load_(builtin, rc, cli, cb) {
// warn about invalid bits.
validate(conf)
- var cafile = conf.get('cafile')
+ var cafile = conf.get("cafile")
if (cafile) {
return conf.loadCAFile(cafile, finalize)
@@ -211,13 +211,13 @@ function Conf (base) {
this.root = configDefs.defaults
}
-Conf.prototype.loadPrefix = require('./lib/load-prefix.js')
-Conf.prototype.loadCAFile = require('./lib/load-cafile.js')
-Conf.prototype.loadUid = require('./lib/load-uid.js')
-Conf.prototype.setUser = require('./lib/set-user.js')
-Conf.prototype.findPrefix = require('./lib/find-prefix.js')
-Conf.prototype.getCredentialsByURI = require('./lib/get-credentials-by-uri.js')
-Conf.prototype.setCredentialsByURI = require('./lib/set-credentials-by-uri.js')
+Conf.prototype.loadPrefix = require("./load-prefix.js")
+Conf.prototype.loadCAFile = require("./load-cafile.js")
+Conf.prototype.loadUid = require("./load-uid.js")
+Conf.prototype.setUser = require("./set-user.js")
+Conf.prototype.findPrefix = require("./find-prefix.js")
+Conf.prototype.getCredentialsByURI = require("./get-credentials-by-uri.js")
+Conf.prototype.setCredentialsByURI = require("./set-credentials-by-uri.js")
Conf.prototype.loadExtras = function(cb) {
this.setUser(function(er) {
@@ -235,17 +235,17 @@ Conf.prototype.loadExtras = function(cb) {
Conf.prototype.save = function (where, cb) {
var target = this.sources[where]
if (!target || !(target.path || target.source) || !target.data) {
- if (where !== 'builtin')
- var er = new Error('bad save target: ' + where)
+ if (where !== "builtin")
+ var er = new Error("bad save target: " + where)
if (cb) {
process.nextTick(cb.bind(null, er))
return this
}
- return this.emit('error', er)
+ return this.emit("error", er)
}
if (target.source) {
- var pref = target.prefix || ''
+ var pref = target.prefix || ""
Object.keys(target.data).forEach(function (k) {
target.source[pref + k] = target.data[k]
})
@@ -259,7 +259,7 @@ Conf.prototype.save = function (where, cb) {
done = done.bind(this)
this._saving ++
- var mode = where === 'user' ? "0600" : "0666"
+ var mode = where === "user" ? "0600" : "0666"
if (!data.trim()) {
fs.unlink(target.path, function (er) {
// ignore the possible error (e.g. the file doesn't exist)
@@ -269,10 +269,10 @@ Conf.prototype.save = function (where, cb) {
mkdirp(path.dirname(target.path), function (er) {
if (er)
return then(er)
- fs.writeFile(target.path, data, 'utf8', function (er) {
+ fs.writeFile(target.path, data, "utf8", function (er) {
if (er)
return then(er)
- if (where === 'user' && myUid && myGid)
+ if (where === "user" && myUid && myGid)
fs.chown(target.path, +myUid, +myGid, then)
else
then()
@@ -289,12 +289,12 @@ Conf.prototype.save = function (where, cb) {
function done (er) {
if (er) {
if (cb) return cb(er)
- else return this.emit('error', er)
+ else return this.emit("error", er)
}
this._saving --
if (this._saving === 0) {
if (cb) cb()
- this.emit('save')
+ this.emit("save")
}
}
@@ -304,20 +304,20 @@ Conf.prototype.save = function (where, cb) {
Conf.prototype.addFile = function (file, name) {
name = name || file
var marker = {__source__:name}
- this.sources[name] = { path: file, type: 'ini' }
+ this.sources[name] = { path: file, type: "ini" }
this.push(marker)
this._await()
- fs.readFile(file, 'utf8', function (er, data) {
+ fs.readFile(file, "utf8", function (er, data) {
if (er) // just ignore missing files.
return this.add({}, marker)
- this.addString(data, file, 'ini', marker)
+ this.addString(data, file, "ini", marker)
}.bind(this))
return this
}
// always ini files.
Conf.prototype.parse = function (content, file) {
- return CC.prototype.parse.call(this, content, file, 'ini')
+ return CC.prototype.parse.call(this, content, file, "ini")
}
Conf.prototype.add = function (data, marker) {
@@ -339,15 +339,15 @@ Conf.prototype.addEnv = function (env) {
// leave first char untouched, even if
// it is a "_" - convert all other to "-"
var p = k.toLowerCase()
- .replace(/^npm_config_/, '')
- .replace(/(?!^)_/g, '-')
+ .replace(/^npm_config_/, "")
+ .replace(/(?!^)_/g, "-")
conf[p] = env[k]
})
- return CC.prototype.addEnv.call(this, '', conf, 'env')
+ return CC.prototype.addEnv.call(this, "", conf, "env")
}
function parseField (f, k) {
- if (typeof f !== 'string' && !(f instanceof String))
+ if (typeof f !== "string" && !(f instanceof String))
return f
// type can be an array or single thing.
@@ -358,25 +358,25 @@ function parseField (f, k) {
var isOctal = -1 !== typeList.indexOf(Octal)
var isNumber = isOctal || (-1 !== typeList.indexOf(Number))
- f = (''+f).trim()
+ f = (""+f).trim()
if (f.match(/^".*"$/))
f = JSON.parse(f)
- if (isBool && !isString && f === '')
+ if (isBool && !isString && f === "")
return true
switch (f) {
- case 'true': return true
- case 'false': return false
- case 'null': return null
- case 'undefined': return undefined
+ case "true": return true
+ case "false": return false
+ case "null": return null
+ case "undefined": return undefined
}
f = envReplace(f)
if (isPath) {
- var homePattern = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//
+ var homePattern = process.platform === "win32" ? /^~(\/|\\)/ : /^~\//
if (f.match(homePattern) && process.env.HOME) {
f = path.resolve(process.env.HOME, f.substr(2))
}
@@ -390,7 +390,7 @@ function parseField (f, k) {
}
function envReplace (f) {
- if (typeof f !== 'string' || !f) return f
+ if (typeof f !== "string" || !f) return f
// replace any ${ENV} values with the appropriate environ.
var envExpr = /(\\*)\$\{([^}]+)\}/g
@@ -399,7 +399,7 @@ function envReplace (f) {
if (esc)
return orig
if (undefined === process.env[name])
- throw new Error('Failed to replace env in config: '+orig)
+ throw new Error("Failed to replace env in config: "+orig)
return process.env[name]
})
}
diff --git a/node_modules/npmconf/config-defs.js b/lib/config/defaults.js
index b0b4acf22..e47f0bb27 100644
--- a/node_modules/npmconf/config-defs.js
+++ b/lib/config/defaults.js
@@ -16,7 +16,7 @@ try {
} catch (er) {
var util = require("util")
log = { warn: function (m) {
- console.warn(m + ' ' + util.format.apply(util, [].slice.call(arguments, 1)))
+ console.warn(m + " " + util.format.apply(util, [].slice.call(arguments, 1)))
} }
}
@@ -41,7 +41,7 @@ function validateSemver (data, k, val) {
}
function validateTag (data, k, val) {
- val = ('' + val).trim()
+ val = ("" + val).trim()
if (!val || semver.validRange(val)) return false
data[k] = val
}
@@ -126,8 +126,8 @@ Object.defineProperty(exports, "defaults", {get: function () {
}
}
- return defaults =
- { "always-auth" : false
+ defaults = {
+ "always-auth" : false
, "bin-links" : true
, browser : null
@@ -231,7 +231,9 @@ Object.defineProperty(exports, "defaults", {get: function () {
, viewer: process.platform === "win32" ? "browser" : "man"
, _exit : true
- }
+ }
+
+ return defaults
}})
exports.types =
diff --git a/node_modules/npmconf/lib/find-prefix.js b/lib/config/find-prefix.js
index bb00cd6b1..bb00cd6b1 100644
--- a/node_modules/npmconf/lib/find-prefix.js
+++ b/lib/config/find-prefix.js
diff --git a/node_modules/npmconf/lib/get-credentials-by-uri.js b/lib/config/get-credentials-by-uri.js
index 26a7f4317..26a7f4317 100644
--- a/node_modules/npmconf/lib/get-credentials-by-uri.js
+++ b/lib/config/get-credentials-by-uri.js
diff --git a/node_modules/npmconf/lib/load-cafile.js b/lib/config/load-cafile.js
index b8c9fff23..dc1ff9f03 100644
--- a/node_modules/npmconf/lib/load-cafile.js
+++ b/lib/config/load-cafile.js
@@ -1,18 +1,18 @@
module.exports = loadCAFile
-var fs = require('fs')
+var fs = require("fs")
function loadCAFile(cafilePath, cb) {
if (!cafilePath)
return process.nextTick(cb)
- fs.readFile(cafilePath, 'utf8', afterCARead.bind(this))
+ fs.readFile(cafilePath, "utf8", afterCARead.bind(this))
function afterCARead(er, cadata) {
if (er)
return cb(er)
- var delim = '-----END CERTIFICATE-----'
+ var delim = "-----END CERTIFICATE-----"
var output
output = cadata
@@ -24,8 +24,7 @@ function loadCAFile(cafilePath, cb) {
return xs.trimLeft() + delim
})
- this.set('ca', output)
+ this.set("ca", output)
cb(null)
}
-
}
diff --git a/node_modules/npmconf/lib/load-prefix.js b/lib/config/load-prefix.js
index bb39d9c98..39d076fb7 100644
--- a/node_modules/npmconf/lib/load-prefix.js
+++ b/lib/config/load-prefix.js
@@ -1,7 +1,7 @@
module.exports = loadPrefix
var findPrefix = require("./find-prefix.js")
-var path = require('path')
+var path = require("path")
function loadPrefix (cb) {
var cli = this.list[0]
@@ -9,7 +9,7 @@ function loadPrefix (cb) {
Object.defineProperty(this, "prefix",
{ set : function (prefix) {
var g = this.get("global")
- this[g ? 'globalPrefix' : 'localPrefix'] = prefix
+ this[g ? "globalPrefix" : "localPrefix"] = prefix
}.bind(this)
, get : function () {
var g = this.get("global")
@@ -20,7 +20,7 @@ function loadPrefix (cb) {
Object.defineProperty(this, "globalPrefix",
{ set : function (prefix) {
- this.set('prefix', prefix)
+ this.set("prefix", prefix)
}.bind(this)
, get : function () {
return path.resolve(this.get("prefix"))
@@ -44,6 +44,6 @@ function loadPrefix (cb) {
findPrefix(process.cwd(), function (er, found) {
p = found
cb(er)
- }.bind(this))
+ })
}
}
diff --git a/node_modules/npmconf/lib/load-uid.js b/lib/config/load-uid.js
index 3ca798773..3ca798773 100644
--- a/node_modules/npmconf/lib/load-uid.js
+++ b/lib/config/load-uid.js
diff --git a/node_modules/npmconf/lib/nerf-dart.js b/lib/config/nerf-dart.js
index 3b26a56c6..3b26a56c6 100644
--- a/node_modules/npmconf/lib/nerf-dart.js
+++ b/lib/config/nerf-dart.js
diff --git a/node_modules/npmconf/lib/set-credentials-by-uri.js b/lib/config/set-credentials-by-uri.js
index 31eab4479..31eab4479 100644
--- a/node_modules/npmconf/lib/set-credentials-by-uri.js
+++ b/lib/config/set-credentials-by-uri.js
diff --git a/node_modules/npmconf/lib/set-user.js b/lib/config/set-user.js
index 002e9bb54..4c207a679 100644
--- a/node_modules/npmconf/lib/set-user.js
+++ b/lib/config/set-user.js
@@ -1,10 +1,9 @@
module.exports = setUser
-var Conf = require('../npmconf.js').Conf
-var assert = require('assert')
-var path = require('path')
-var fs = require('fs')
-var mkdirp = require('mkdirp')
+var assert = require("assert")
+var path = require("path")
+var fs = require("fs")
+var mkdirp = require("mkdirp")
function setUser (cb) {
var defaultConf = this.root
diff --git a/lib/npm.js b/lib/npm.js
index 4fb693df8..e933a1346 100644
--- a/lib/npm.js
+++ b/lib/npm.js
@@ -16,7 +16,7 @@ require('child-process-close')
var EventEmitter = require("events").EventEmitter
, npm = module.exports = new EventEmitter()
- , npmconf = require("npmconf")
+ , npmconf = require("./config/core.js")
, log = require("npmlog")
, fs = require("graceful-fs")
, path = require("path")
diff --git a/lib/publish.js b/lib/publish.js
index b43d26d10..2a0fcff5a 100644
--- a/lib/publish.js
+++ b/lib/publish.js
@@ -8,7 +8,7 @@ var url = require("url")
, readJson = require("read-package-json")
, lifecycle = require("./utils/lifecycle.js")
, chain = require("slide").chain
- , Conf = require("npmconf").Conf
+ , Conf = require("./config/core.js").Conf
, RegClient = require("npm-registry-client")
, mapToRegistry = require("./utils/map-to-registry.js")
, cachedPackageRoot = require("./cache/cached-package-root.js")
diff --git a/node_modules/npmconf/node_modules/config-chain/.npmignore b/node_modules/config-chain/.npmignore
index 13abef4f5..13abef4f5 100644
--- a/node_modules/npmconf/node_modules/config-chain/.npmignore
+++ b/node_modules/config-chain/.npmignore
diff --git a/node_modules/npmconf/node_modules/config-chain/LICENCE b/node_modules/config-chain/LICENCE
index 171dd9700..171dd9700 100644
--- a/node_modules/npmconf/node_modules/config-chain/LICENCE
+++ b/node_modules/config-chain/LICENCE
diff --git a/node_modules/npmconf/node_modules/config-chain/index.js b/node_modules/config-chain/index.js
index 0ef3a91f7..0ef3a91f7 100755
--- a/node_modules/npmconf/node_modules/config-chain/index.js
+++ b/node_modules/config-chain/index.js
diff --git a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/LICENSE b/node_modules/config-chain/node_modules/proto-list/LICENSE
index 05a401094..05a401094 100644
--- a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/LICENSE
+++ b/node_modules/config-chain/node_modules/proto-list/LICENSE
diff --git a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/README.md b/node_modules/config-chain/node_modules/proto-list/README.md
index 43cfa3589..43cfa3589 100644
--- a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/README.md
+++ b/node_modules/config-chain/node_modules/proto-list/README.md
diff --git a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json b/node_modules/config-chain/node_modules/proto-list/package.json
index f5b39aa2c..2dff2917c 100644
--- a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/package.json
+++ b/node_modules/config-chain/node_modules/proto-list/package.json
@@ -29,7 +29,7 @@
"homepage": "https://github.com/isaacs/proto-list",
"_id": "proto-list@1.2.3",
"_shasum": "6235554a1bca1f0d15e3ca12ca7329d5def42bd9",
- "_from": "proto-list@>=1.2.1 <1.3.0",
+ "_from": "proto-list@~1.2.1",
"_npmVersion": "1.4.14",
"_npmUser": {
"name": "isaacs",
diff --git a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/proto-list.js b/node_modules/config-chain/node_modules/proto-list/proto-list.js
index b55c25c05..b55c25c05 100644
--- a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/proto-list.js
+++ b/node_modules/config-chain/node_modules/proto-list/proto-list.js
diff --git a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/test/basic.js b/node_modules/config-chain/node_modules/proto-list/test/basic.js
index 5cd66bef1..5cd66bef1 100644
--- a/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list/test/basic.js
+++ b/node_modules/config-chain/node_modules/proto-list/test/basic.js
diff --git a/node_modules/npmconf/node_modules/config-chain/package.json b/node_modules/config-chain/package.json
index cf8358a33..a07f2f414 100644
--- a/node_modules/npmconf/node_modules/config-chain/package.json
+++ b/node_modules/config-chain/package.json
@@ -32,7 +32,7 @@
"shasum": "0943d0b7227213a20d4eaff4434f4a1c0a052cad",
"tarball": "http://registry.npmjs.org/config-chain/-/config-chain-1.1.8.tgz"
},
- "_from": "config-chain@>=1.1.8 <1.2.0",
+ "_from": "config-chain@^1.1.8",
"_npmVersion": "1.3.6",
"_npmUser": {
"name": "dominictarr",
diff --git a/node_modules/npmconf/node_modules/config-chain/readme.markdown b/node_modules/config-chain/readme.markdown
index c83a43067..c83a43067 100644
--- a/node_modules/npmconf/node_modules/config-chain/readme.markdown
+++ b/node_modules/config-chain/readme.markdown
diff --git a/node_modules/npmconf/node_modules/config-chain/test/broken.js b/node_modules/config-chain/test/broken.js
index 101a3e4f5..101a3e4f5 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/broken.js
+++ b/node_modules/config-chain/test/broken.js
diff --git a/node_modules/npmconf/node_modules/config-chain/test/broken.json b/node_modules/config-chain/test/broken.json
index 2107ac18d..2107ac18d 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/broken.json
+++ b/node_modules/config-chain/test/broken.json
diff --git a/node_modules/npmconf/node_modules/config-chain/test/chain-class.js b/node_modules/config-chain/test/chain-class.js
index bbc0d4cb2..bbc0d4cb2 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/chain-class.js
+++ b/node_modules/config-chain/test/chain-class.js
diff --git a/node_modules/npmconf/node_modules/config-chain/test/env.js b/node_modules/config-chain/test/env.js
index fb718f32b..fb718f32b 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/env.js
+++ b/node_modules/config-chain/test/env.js
diff --git a/node_modules/npmconf/node_modules/config-chain/test/find-file.js b/node_modules/config-chain/test/find-file.js
index 23cde52ea..23cde52ea 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/find-file.js
+++ b/node_modules/config-chain/test/find-file.js
diff --git a/node_modules/npmconf/node_modules/config-chain/test/get.js b/node_modules/config-chain/test/get.js
index d6fd79f74..d6fd79f74 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/get.js
+++ b/node_modules/config-chain/test/get.js
diff --git a/node_modules/npmconf/node_modules/config-chain/test/ignore-unfound-file.js b/node_modules/config-chain/test/ignore-unfound-file.js
index d742b82ba..d742b82ba 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/ignore-unfound-file.js
+++ b/node_modules/config-chain/test/ignore-unfound-file.js
diff --git a/node_modules/npmconf/node_modules/config-chain/test/ini.js b/node_modules/config-chain/test/ini.js
index 5572a6ed6..5572a6ed6 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/ini.js
+++ b/node_modules/config-chain/test/ini.js
diff --git a/node_modules/npmconf/node_modules/config-chain/test/save.js b/node_modules/config-chain/test/save.js
index 783461317..783461317 100644
--- a/node_modules/npmconf/node_modules/config-chain/test/save.js
+++ b/node_modules/config-chain/test/save.js
diff --git a/node_modules/npm-registry-client/package.json b/node_modules/npm-registry-client/package.json
index 389d3a4d2..5fe816465 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": "3.2.2",
+ "version": "3.2.3",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
@@ -36,18 +36,15 @@
"optionalDependencies": {
"npmlog": ""
},
- "peerDependencies": {
- "npmconf": "^2.1.0"
- },
"license": "ISC",
"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)\nvar uri = \"npm://registry.npmjs.org/npm\"\nvar options = {timeout: 1000}\n\nclient.get(uri, options, function (error, 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# Registry URLs\n\nThe registry calls take either a full URL pointing to a resource in the\nregistry, or a base URL for the registry as a whole (for the base URL, any path\nwill be ignored). In addition to `http` and `https`, `npm` URLs are allowed.\n`npm` URLs are `https` URLs with the additional restrictions that they will\nalways include authorization credentials, and the response is always registry\nmetadata (and not tarballs or other attachments).\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* `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, uri, options, cb)\n\n* `method` {String} HTTP method\n* `uri` {String} URI pointing to the resource to request\n* `options` {Object} Object containing optional per-request properties.\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 * `follow` {Boolean} Follow 302/301 responses (defaults to true)\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 around\n`request`.\n\n# client.adduser(base, username, password, email, cb)\n\n* `base` {String} Base registry URL\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(uri, version, message, cb)\n\n* `uri` {String} Full registry URI for the deprecated package\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(uri, cb)\n\n* `uri` {String} Full registry URI for the package\n* `cb` {Function}\n\nGet the url for bugs of a package\n\n# client.get(uri, options, cb)\n\n* `uri` {String} The complete registry URI to fetch\n* `options` {Object} Object containing optional per-request properties.\n * `timeout` {Number} Duration before the request times out.\n * `follow` {Boolean} Follow 302/301 responses (defaults to true)\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 the cache folder\nwith the ETag.\n\n# client.publish(uri, data, tarball, cb)\n\n* `uri` {String} The registry URI to publish to\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 can\naccept a gzipped tar stream or a filename to a tarball.\n\n# client.star(uri, starred, cb)\n\n* `uri` {String} The complete registry URI 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 unstar a\npackage, though other writes do require that the user be the package owner.\n\n# client.stars(base, username, cb)\n\n* `base` {String} The base URL for the registry\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(uri, version, tag, cb)\n\n* `uri` {String} The complete registry URI to tag\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` will fetch the\nspecified version.\n\n# client.unpublish(uri, [ver], cb)\n\n* `uri` {String} The complete registry URI to unpublish\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 the\nlast version us unpublished, the entire document is removed from the database.\n\n# client.upload(uri, file, [etag], [nofollow], cb)\n\n* `uri` {String} The complete registry URI 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": "cfb2498d139044cd6bfac65cdf38fad2258f12d4",
+ "gitHead": "da48956abfc4656c5d1a79f0beac56a13ac78294",
"bugs": {
"url": "https://github.com/isaacs/npm-registry-client/issues"
},
"homepage": "https://github.com/isaacs/npm-registry-client",
- "_id": "npm-registry-client@3.2.2",
- "_shasum": "7c4ef979cf61b411d15421a24ac2b3b846f8bd53",
- "_from": "npm-registry-client@>=3.2.2 <3.3.0"
+ "_id": "npm-registry-client@3.2.3",
+ "_shasum": "ae6cf0c32d28061d8cdadb34bf22e903b6687539",
+ "_from": "npm-registry-client@>=3.2.3 <4.0.0"
}
diff --git a/node_modules/npmconf/.npmignore b/node_modules/npmconf/.npmignore
deleted file mode 100644
index 485007791..000000000
--- a/node_modules/npmconf/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/test/fixtures/userconfig-with-gc
-.eslintrc
-.jshintrc
diff --git a/node_modules/npmconf/LICENSE b/node_modules/npmconf/LICENSE
deleted file mode 100644
index 0c44ae716..000000000
--- a/node_modules/npmconf/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) Isaac Z. Schlueter ("Author")
-All rights reserved.
-
-The BSD License
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/npmconf/README.md b/node_modules/npmconf/README.md
deleted file mode 100644
index afc995d1a..000000000
--- a/node_modules/npmconf/README.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# npmconf
-
-The config thing npm uses
-
-If you are interested in interacting with the config settings that npm
-uses, then use this module.
-
-However, if you are writing a new Node.js program, and want
-configuration functionality similar to what npm has, but for your
-own thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),
-which is probably what you want.
-
-If I were to do it all over again, that's what I'd do for npm. But,
-alas, there are many systems depending on many of the particulars of
-npm's configuration setup, so it's not worth the cost of changing.
-
-## USAGE
-
-```javascript
-var npmconf = require('npmconf')
-
-// pass in the cli options that you read from the cli
-// or whatever top-level configs you want npm to use for now.
-npmconf.load({some:'configs'}, function (er, conf) {
- // do stuff with conf
- conf.get('some', 'cli') // 'configs'
- conf.get('username') // 'joebobwhatevers'
- conf.set('foo', 'bar', 'user')
- conf.save('user', function (er) {
- // foo = bar is now saved to ~/.npmrc or wherever
- })
-})
-```
diff --git a/node_modules/npmconf/package.json b/node_modules/npmconf/package.json
deleted file mode 100644
index d8766aa5a..000000000
--- a/node_modules/npmconf/package.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "name": "npmconf",
- "version": "2.1.0",
- "description": "The config thing npm uses",
- "main": "npmconf.js",
- "directories": {
- "test": "test"
- },
- "dependencies": {
- "config-chain": "~1.1.8",
- "inherits": "~2.0.0",
- "ini": "^1.2.0",
- "mkdirp": "^0.5.0",
- "nopt": "~3.0.1",
- "once": "~1.3.0",
- "osenv": "^0.1.0",
- "semver": "2 || 3 || 4",
- "uid-number": "0.0.5"
- },
- "devDependencies": {
- "tap": "~0.4.0"
- },
- "scripts": {
- "test": "tap test/*.js"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/npmconf"
- },
- "keywords": [
- "npm",
- "config",
- "config-chain",
- "conf",
- "ini"
- ],
- "author": {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me",
- "url": "http://blog.izs.me"
- },
- "license": "BSD",
- "readme": "# npmconf\n\nThe config thing npm uses\n\nIf you are interested in interacting with the config settings that npm\nuses, then use this module.\n\nHowever, if you are writing a new Node.js program, and want\nconfiguration functionality similar to what npm has, but for your\nown thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),\nwhich is probably what you want.\n\nIf I were to do it all over again, that's what I'd do for npm. But,\nalas, there are many systems depending on many of the particulars of\nnpm's configuration setup, so it's not worth the cost of changing.\n\n## USAGE\n\n```javascript\nvar npmconf = require('npmconf')\n\n// pass in the cli options that you read from the cli\n// or whatever top-level configs you want npm to use for now.\nnpmconf.load({some:'configs'}, function (er, conf) {\n // do stuff with conf\n conf.get('some', 'cli') // 'configs'\n conf.get('username') // 'joebobwhatevers'\n conf.set('foo', 'bar', 'user')\n conf.save('user', function (er) {\n // foo = bar is now saved to ~/.npmrc or wherever\n })\n})\n```\n",
- "readmeFilename": "README.md",
- "gitHead": "6ab2c861283b3e292a97509d12b1d53e31ed1584",
- "bugs": {
- "url": "https://github.com/isaacs/npmconf/issues"
- },
- "homepage": "https://github.com/isaacs/npmconf",
- "_id": "npmconf@2.1.0",
- "_shasum": "6dcdbd1fe3d7373b78ec74ab69e919d4954f76b0",
- "_from": "npmconf@>=2.1.0 <2.2.0"
-}
diff --git a/node_modules/npmconf/test/00-setup.js b/node_modules/npmconf/test/00-setup.js
deleted file mode 100644
index 3f5109f04..000000000
--- a/node_modules/npmconf/test/00-setup.js
+++ /dev/null
@@ -1,67 +0,0 @@
-var path = require('path')
-var userconfigSrc = path.resolve(__dirname, 'fixtures', 'userconfig')
-exports.userconfig = userconfigSrc + '-with-gc'
-exports.globalconfig = path.resolve(__dirname, 'fixtures', 'globalconfig')
-exports.builtin = path.resolve(__dirname, 'fixtures', 'builtin')
-exports.ucData =
- { globalconfig: exports.globalconfig,
- email: 'i@izs.me',
- 'env-thing': 'asdf',
- 'init.author.name': 'Isaac Z. Schlueter',
- 'init.author.email': 'i@izs.me',
- 'init.author.url': 'http://blog.izs.me/',
- 'init.version': '1.2.3',
- 'proprietary-attribs': false,
- 'npm:publishtest': true,
- '_npmjs.org:couch': 'https://admin:password@localhost:5984/registry',
- 'npm-www:nocache': '1',
- nodedir: '/Users/isaacs/dev/js/node-v0.8',
- 'sign-git-tag': true,
- message: 'v%s',
- 'strict-ssl': false,
- 'tmp': process.env.HOME + '/.tmp',
- _auth: 'dXNlcm5hbWU6cGFzc3dvcmQ=',
- _token:
- { AuthSession: 'yabba-dabba-doodle',
- version: '1',
- expires: '1345001053415',
- path: '/',
- httponly: true } }
-
-// set the userconfig in the env
-// unset anything else that npm might be trying to foist on us
-Object.keys(process.env).forEach(function (k) {
- if (k.match(/^npm_config_/i)) {
- delete process.env[k]
- }
-})
-process.env.npm_config_userconfig = exports.userconfig
-process.env.npm_config_other_env_thing = 1000
-process.env.random_env_var = 'asdf'
-process.env.npm_config__underbar_env_thing = 'underful'
-process.env.NPM_CONFIG_UPPERCASE_ENV_THING = 42
-
-exports.envData = {
- userconfig: exports.userconfig,
- '_underbar-env-thing': 'underful',
- 'uppercase-env-thing': '42',
- 'other-env-thing': '1000'
-}
-exports.envDataFix = {
- userconfig: exports.userconfig,
- '_underbar-env-thing': 'underful',
- 'uppercase-env-thing': 42,
- 'other-env-thing': 1000,
-}
-
-
-if (module === require.main) {
- // set the globalconfig in the userconfig
- var fs = require('fs')
- var uc = fs.readFileSync(userconfigSrc)
- var gcini = 'globalconfig = ' + exports.globalconfig + '\n'
- fs.writeFileSync(exports.userconfig, gcini + uc)
-
- console.log('0..1')
- console.log('ok 1 setup done')
-}
diff --git a/node_modules/npmconf/test/basic.js b/node_modules/npmconf/test/basic.js
deleted file mode 100644
index e3a684f94..000000000
--- a/node_modules/npmconf/test/basic.js
+++ /dev/null
@@ -1,58 +0,0 @@
-var test = require('tap').test
-var npmconf = require('../npmconf.js')
-var common = require('./00-setup.js')
-var path = require('path')
-
-var projectData = {}
-
-var ucData = common.ucData
-var envData = common.envData
-var envDataFix = common.envDataFix
-
-var gcData = { 'package-config:foo': 'boo' }
-
-var biData = {}
-
-var cli = { foo: 'bar', umask: 022 }
-
-var expectList =
-[ cli,
- envDataFix,
- projectData,
- ucData,
- gcData,
- biData ]
-
-var expectSources =
-{ cli: { data: cli },
- env:
- { data: envDataFix,
- source: envData,
- prefix: '' },
- project:
- { path: path.resolve(__dirname, '..', '.npmrc'),
- type: 'ini',
- data: projectData },
- user:
- { path: common.userconfig,
- type: 'ini',
- data: ucData },
- global:
- { path: common.globalconfig,
- type: 'ini',
- data: gcData },
- builtin: { data: biData } }
-
-test('no builtin', function (t) {
- npmconf.load(cli, function (er, conf) {
- if (er) throw er
- t.same(conf.list, expectList)
- t.same(conf.sources, expectSources)
- t.same(npmconf.rootConf.list, [])
- t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
- t.equal(conf.root, npmconf.defs.defaults)
- t.equal(conf.get('umask'), 022)
- t.equal(conf.get('heading'), 'npm')
- t.end()
- })
-})
diff --git a/node_modules/npmconf/test/builtin.js b/node_modules/npmconf/test/builtin.js
deleted file mode 100644
index c94de8abd..000000000
--- a/node_modules/npmconf/test/builtin.js
+++ /dev/null
@@ -1,59 +0,0 @@
-var test = require('tap').test
-var npmconf = require('../npmconf.js')
-var common = require('./00-setup.js')
-var path = require('path')
-
-var ucData = common.ucData
-
-var envData = common.envData
-var envDataFix = common.envDataFix
-
-var gcData = { 'package-config:foo': 'boo' }
-
-var biData = { 'builtin-config': true }
-
-var cli = { foo: 'bar', heading: 'foo', 'git-tag-version': false }
-
-var projectData = {}
-
-var expectList =
-[ cli,
- envDataFix,
- projectData,
- ucData,
- gcData,
- biData ]
-
-var expectSources =
-{ cli: { data: cli },
- env:
- { data: envDataFix,
- source: envData,
- prefix: '' },
- project:
- { path: path.resolve(__dirname, '..', '.npmrc'),
- type: 'ini',
- data: projectData },
- user:
- { path: common.userconfig,
- type: 'ini',
- data: ucData },
- global:
- { path: common.globalconfig,
- type: 'ini',
- data: gcData },
- builtin: { data: biData } }
-
-test('with builtin', function (t) {
- npmconf.load(cli, common.builtin, function (er, conf) {
- if (er) throw er
- t.same(conf.list, expectList)
- t.same(conf.sources, expectSources)
- t.same(npmconf.rootConf.list, [])
- t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
- t.equal(conf.root, npmconf.defs.defaults)
- t.equal(conf.get('heading'), 'foo')
- t.equal(conf.get('git-tag-version'), false)
- t.end()
- })
-})
diff --git a/node_modules/npmconf/test/certfile.js b/node_modules/npmconf/test/certfile.js
deleted file mode 100644
index 3dfb6e90f..000000000
--- a/node_modules/npmconf/test/certfile.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var test = require('tap').test
-var npmconf = require('../npmconf.js')
-var common = require('./00-setup.js')
-var path = require('path')
-var fs = require('fs')
-
-test('cafile loads as ca', function (t) {
- var cafile = path.join(__dirname, 'fixtures', 'multi-ca')
-
- npmconf.load({cafile: cafile}, function (er, conf) {
- if (er) throw er
-
- t.same(conf.get('cafile'), cafile)
- t.same(conf.get('ca').join('\n'), fs.readFileSync(cafile, 'utf8').trim())
- t.end()
- })
-})
diff --git a/node_modules/npmconf/test/project.js b/node_modules/npmconf/test/project.js
deleted file mode 100644
index d9a0bdbcc..000000000
--- a/node_modules/npmconf/test/project.js
+++ /dev/null
@@ -1,60 +0,0 @@
-var test = require('tap').test
-var npmconf = require('../npmconf.js')
-var common = require('./00-setup.js')
-var path = require('path')
-var fix = path.resolve(__dirname, 'fixtures')
-var projectRc = path.resolve(fix, '.npmrc')
-
-var projectData = { just: 'testing' }
-
-var ucData = common.ucData
-var envData = common.envData
-var envDataFix = common.envDataFix
-
-var gcData = { 'package-config:foo': 'boo' }
-
-var biData = {}
-
-var cli = { foo: 'bar', umask: 022, prefix: fix }
-
-var expectList =
-[ cli,
- envDataFix,
- projectData,
- ucData,
- gcData,
- biData ]
-
-var expectSources =
-{ cli: { data: cli },
- env:
- { data: envDataFix,
- source: envData,
- prefix: '' },
- project:
- { path: projectRc,
- type: 'ini',
- data: projectData },
- user:
- { path: common.userconfig,
- type: 'ini',
- data: ucData },
- global:
- { path: common.globalconfig,
- type: 'ini',
- data: gcData },
- builtin: { data: biData } }
-
-test('no builtin', function (t) {
- npmconf.load(cli, function (er, conf) {
- if (er) throw er
- t.same(conf.list, expectList)
- t.same(conf.sources, expectSources)
- t.same(npmconf.rootConf.list, [])
- t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
- t.equal(conf.root, npmconf.defs.defaults)
- t.equal(conf.get('umask'), 022)
- t.equal(conf.get('heading'), 'npm')
- t.end()
- })
-})
diff --git a/node_modules/npmconf/test/save.js b/node_modules/npmconf/test/save.js
deleted file mode 100644
index 0d2f1978f..000000000
--- a/node_modules/npmconf/test/save.js
+++ /dev/null
@@ -1,84 +0,0 @@
-var test = require('tap').test
-var npmconf = require('../npmconf.js')
-var common = require('./00-setup.js')
-var fs = require('fs')
-var ini = require('ini')
-var expectConf =
- [ 'globalconfig = ' + common.globalconfig,
- 'email = i@izs.me',
- 'env-thing = asdf',
- 'init.author.name = Isaac Z. Schlueter',
- 'init.author.email = i@izs.me',
- 'init.author.url = http://blog.izs.me/',
- 'init.version = 1.2.3',
- 'proprietary-attribs = false',
- 'npm:publishtest = true',
- '_npmjs.org:couch = https://admin:password@localhost:5984/registry',
- 'npm-www:nocache = 1',
- 'sign-git-tag = false',
- 'message = v%s',
- 'strict-ssl = false',
- '_auth = dXNlcm5hbWU6cGFzc3dvcmQ=',
- '',
- '[_token]',
- 'AuthSession = yabba-dabba-doodle',
- 'version = 1',
- 'expires = 1345001053415',
- 'path = /',
- 'httponly = true',
- '' ].join('\n')
-var expectFile =
- [ 'globalconfig = ' + common.globalconfig,
- 'email = i@izs.me',
- 'env-thing = asdf',
- 'init.author.name = Isaac Z. Schlueter',
- 'init.author.email = i@izs.me',
- 'init.author.url = http://blog.izs.me/',
- 'init.version = 1.2.3',
- 'proprietary-attribs = false',
- 'npm:publishtest = true',
- '_npmjs.org:couch = https://admin:password@localhost:5984/registry',
- 'npm-www:nocache = 1',
- 'sign-git-tag = false',
- 'message = v%s',
- 'strict-ssl = false',
- '_auth = dXNlcm5hbWU6cGFzc3dvcmQ=',
- '',
- '[_token]',
- 'AuthSession = yabba-dabba-doodle',
- 'version = 1',
- 'expires = 1345001053415',
- 'path = /',
- 'httponly = true',
- '' ].join('\n')
-
-test('saving configs', function (t) {
- npmconf.load(function (er, conf) {
- if (er)
- throw er
- conf.set('sign-git-tag', false, 'user')
- conf.del('nodedir')
- conf.del('tmp')
- var foundConf = ini.stringify(conf.sources.user.data)
- t.same(ini.parse(foundConf), ini.parse(expectConf))
- fs.unlinkSync(common.userconfig)
- conf.save('user', function (er) {
- if (er)
- throw er
- var uc = fs.readFileSync(conf.get('userconfig'), 'utf8')
- t.same(ini.parse(uc), ini.parse(expectFile))
- t.end()
- })
- })
-})
-
-test('setting prefix', function (t) {
- npmconf.load(function (er, conf) {
- if (er)
- throw er
-
- conf.prefix = 'newvalue'
- t.same(conf.prefix, 'newvalue');
- t.end();
- })
-})
diff --git a/node_modules/npmconf/test/semver-tag.js b/node_modules/npmconf/test/semver-tag.js
deleted file mode 100644
index b0ce27f1b..000000000
--- a/node_modules/npmconf/test/semver-tag.js
+++ /dev/null
@@ -1,65 +0,0 @@
-var test = require('tap').test
-var npmconf = require('../npmconf.js')
-var common = require('./00-setup.js')
-var path = require('path')
-
-var ucData = common.ucData
-
-var envData = common.envData
-var envDataFix = common.envDataFix
-
-var gcData = { 'package-config:foo': 'boo' }
-
-var biData = { 'builtin-config': true }
-
-var cli = { tag: 'v2.x' }
-
-var projectData = {}
-
-var expectList =
-[ cli,
- envDataFix,
- projectData,
- ucData,
- gcData,
- biData ]
-
-
-var expectSources =
-{ cli: { data: cli },
- env:
- { data: envDataFix,
- source: envData,
- prefix: '' },
- project:
- { path: path.resolve(__dirname, '..', '.npmrc'),
- type: 'ini',
- data: projectData },
- user:
- { path: common.userconfig,
- type: 'ini',
- data: ucData },
- global:
- { path: common.globalconfig,
- type: 'ini',
- data: gcData },
- builtin: { data: biData } }
-
-test('tag cannot be a SemVer', function (t) {
- var messages = []
- console.warn = function (m) {
- messages.push(m)
- }
-
- var expect = [
- 'invalid config tag="v2.x"',
- 'invalid config Tag must not be a SemVer range'
- ]
-
- npmconf.load(cli, common.builtin, function (er, conf) {
- if (er) throw er
- t.equal(conf.get('tag'), 'latest')
- t.same(messages, expect)
- t.end()
- })
-})
diff --git a/package.json b/package.json
index 489199f21..3d6f9d906 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"chownr": "0",
"cmd-shim": "~2.0.1",
"columnify": "~1.2.1",
+ "config-chain": "~1.1.8",
"dezalgo": "~1.0.1",
"editor": "~0.1.0",
"fs-vacuum": "~1.2.1",
@@ -68,9 +69,8 @@
"npm-cache-filename": "~1.0.1",
"npm-install-checks": "~1.0.2",
"npm-package-arg": "~2.1.3",
- "npm-registry-client": "~3.2.2",
+ "npm-registry-client": "~3.2.3",
"npm-user-validate": "~0.1.0",
- "npmconf": "~2.1.0",
"npmlog": "~0.1.1",
"once": "~1.3.0",
"opener": "~1.3.0",
@@ -109,6 +109,7 @@
"chownr",
"cmd-shim",
"columnify",
+ "config-chain",
"dezalgo",
"editor",
"fs-vacuum",
@@ -135,7 +136,6 @@
"npm-package-arg",
"npm-registry-client",
"npm-user-validate",
- "npmconf",
"npmlog",
"once",
"opener",
diff --git a/node_modules/npmconf/test/fixtures/.npmrc b/test/fixtures/config/.npmrc
index 7d59bd8be..7d59bd8be 100644
--- a/node_modules/npmconf/test/fixtures/.npmrc
+++ b/test/fixtures/config/.npmrc
diff --git a/node_modules/npmconf/test/fixtures/builtin b/test/fixtures/config/builtin
index dcd542c0c..dcd542c0c 100644
--- a/node_modules/npmconf/test/fixtures/builtin
+++ b/test/fixtures/config/builtin
diff --git a/node_modules/npmconf/test/fixtures/globalconfig b/test/fixtures/config/globalconfig
index 41c0b70c8..41c0b70c8 100644
--- a/node_modules/npmconf/test/fixtures/globalconfig
+++ b/test/fixtures/config/globalconfig
diff --git a/node_modules/npmconf/test/fixtures/multi-ca b/test/fixtures/config/multi-ca
index 0bc922b25..0bc922b25 100644
--- a/node_modules/npmconf/test/fixtures/multi-ca
+++ b/test/fixtures/config/multi-ca
diff --git a/node_modules/npmconf/test/fixtures/package.json b/test/fixtures/config/package.json
index e69de29bb..e69de29bb 100644
--- a/node_modules/npmconf/test/fixtures/package.json
+++ b/test/fixtures/config/package.json
diff --git a/node_modules/npmconf/test/fixtures/userconfig b/test/fixtures/config/userconfig
index d600c0664..d600c0664 100644
--- a/node_modules/npmconf/test/fixtures/userconfig
+++ b/test/fixtures/config/userconfig
diff --git a/test/tap/00-config-setup.js b/test/tap/00-config-setup.js
new file mode 100644
index 000000000..2de5d21dd
--- /dev/null
+++ b/test/tap/00-config-setup.js
@@ -0,0 +1,67 @@
+var path = require("path")
+var userconfigSrc = path.resolve(__dirname, "..", "fixtures", "config", "userconfig")
+exports.userconfig = userconfigSrc + "-with-gc"
+exports.globalconfig = path.resolve(__dirname, "..", "fixtures", "config", "globalconfig")
+exports.builtin = path.resolve(__dirname, "..", "fixtures", "config", "builtin")
+exports.ucData =
+ { globalconfig: exports.globalconfig,
+ email: "i@izs.me",
+ "env-thing": "asdf",
+ "init.author.name": "Isaac Z. Schlueter",
+ "init.author.email": "i@izs.me",
+ "init.author.url": "http://blog.izs.me/",
+ "init.version": "1.2.3",
+ "proprietary-attribs": false,
+ "npm:publishtest": true,
+ "_npmjs.org:couch": "https://admin:password@localhost:5984/registry",
+ "npm-www:nocache": "1",
+ nodedir: "/Users/isaacs/dev/js/node-v0.8",
+ "sign-git-tag": true,
+ message: "v%s",
+ "strict-ssl": false,
+ "tmp": process.env.HOME + "/.tmp",
+ _auth: "dXNlcm5hbWU6cGFzc3dvcmQ=",
+ _token:
+ { AuthSession: "yabba-dabba-doodle",
+ version: "1",
+ expires: "1345001053415",
+ path: "/",
+ httponly: true } }
+
+// set the userconfig in the env
+// unset anything else that npm might be trying to foist on us
+Object.keys(process.env).forEach(function (k) {
+ if (k.match(/^npm_config_/i)) {
+ delete process.env[k]
+ }
+})
+process.env.npm_config_userconfig = exports.userconfig
+process.env.npm_config_other_env_thing = 1000
+process.env.random_env_var = "asdf"
+process.env.npm_config__underbar_env_thing = "underful"
+process.env.NPM_CONFIG_UPPERCASE_ENV_THING = 42
+
+exports.envData = {
+ userconfig: exports.userconfig,
+ "_underbar-env-thing": "underful",
+ "uppercase-env-thing": "42",
+ "other-env-thing": "1000"
+}
+exports.envDataFix = {
+ userconfig: exports.userconfig,
+ "_underbar-env-thing": "underful",
+ "uppercase-env-thing": 42,
+ "other-env-thing": 1000
+}
+
+
+if (module === require.main) {
+ // set the globalconfig in the userconfig
+ var fs = require("fs")
+ var uc = fs.readFileSync(userconfigSrc)
+ var gcini = "globalconfig = " + exports.globalconfig + "\n"
+ fs.writeFileSync(exports.userconfig, gcini + uc)
+
+ console.log("0..1")
+ console.log("ok 1 setup done")
+}
diff --git a/test/tap/config-basic.js b/test/tap/config-basic.js
new file mode 100644
index 000000000..d5a950a8e
--- /dev/null
+++ b/test/tap/config-basic.js
@@ -0,0 +1,66 @@
+var test = require("tap").test
+var npmconf = require("../../lib/config/core.js")
+var common = require("./00-config-setup.js")
+var path = require("path")
+
+var projectData = {
+ "save-prefix": "~",
+ "proprietary-attribs": false
+}
+
+var ucData = common.ucData
+var envData = common.envData
+var envDataFix = common.envDataFix
+
+var gcData = { "package-config:foo": "boo" }
+
+var biData = {}
+
+var cli = { foo: "bar", umask: 022 }
+
+var expectList =
+[ cli,
+ envDataFix,
+ projectData,
+ ucData,
+ gcData,
+ biData ]
+
+var expectSources = {
+ cli: { data: cli },
+ env: {
+ data: envDataFix,
+ source: envData,
+ prefix: ""
+ },
+ project: {
+ path: path.resolve(__dirname, "..", "..", ".npmrc"),
+ type: "ini",
+ data: projectData
+ },
+ user: {
+ path: common.userconfig,
+ type: "ini",
+ data: ucData
+ },
+ global: {
+ path: common.globalconfig,
+ type: "ini",
+ data: gcData
+ },
+ builtin: { data: biData }
+}
+
+test("no builtin", function (t) {
+ npmconf.load(cli, function (er, conf) {
+ if (er) throw er
+ t.same(conf.list, expectList)
+ t.same(conf.sources, expectSources)
+ t.same(npmconf.rootConf.list, [])
+ t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
+ t.equal(conf.root, npmconf.defs.defaults)
+ t.equal(conf.get("umask"), 022)
+ t.equal(conf.get("heading"), "npm")
+ t.end()
+ })
+})
diff --git a/test/tap/config-builtin.js b/test/tap/config-builtin.js
new file mode 100644
index 000000000..5a1589ff6
--- /dev/null
+++ b/test/tap/config-builtin.js
@@ -0,0 +1,68 @@
+var test = require("tap").test
+var npmconf = require("../../lib/config/core.js")
+var common = require("./00-config-setup.js")
+var path = require("path")
+
+var ucData = common.ucData
+
+var envData = common.envData
+var envDataFix = common.envDataFix
+
+var gcData = { "package-config:foo": "boo" }
+
+var biData = { "builtin-config": true }
+
+var cli = { foo: "bar", heading: "foo", "git-tag-version": false }
+
+var projectData = {
+ "save-prefix": "~",
+ "proprietary-attribs": false
+}
+
+var expectList = [
+ cli,
+ envDataFix,
+ projectData,
+ ucData,
+ gcData,
+ biData
+]
+
+var expectSources = {
+ cli: { data: cli },
+ env: {
+ data: envDataFix,
+ source: envData,
+ prefix: ""
+ },
+ project: {
+ path: path.resolve(__dirname, "..", "..", ".npmrc"),
+ type: "ini",
+ data: projectData
+ },
+ user: {
+ path: common.userconfig,
+ type: "ini",
+ data: ucData
+ },
+ global: {
+ path: common.globalconfig,
+ type: "ini",
+ data: gcData
+ },
+ builtin: { data: biData }
+}
+
+test("with builtin", function (t) {
+ npmconf.load(cli, common.builtin, function (er, conf) {
+ if (er) throw er
+ t.same(conf.list, expectList)
+ t.same(conf.sources, expectSources)
+ t.same(npmconf.rootConf.list, [])
+ t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
+ t.equal(conf.root, npmconf.defs.defaults)
+ t.equal(conf.get("heading"), "foo")
+ t.equal(conf.get("git-tag-version"), false)
+ t.end()
+ })
+})
diff --git a/test/tap/config-certfile.js b/test/tap/config-certfile.js
new file mode 100644
index 000000000..25de9963a
--- /dev/null
+++ b/test/tap/config-certfile.js
@@ -0,0 +1,18 @@
+require("./00-config-setup.js")
+
+var path = require("path")
+var fs = require("fs")
+var test = require("tap").test
+var npmconf = require("../../lib/config/core.js")
+
+test("cafile loads as ca", function (t) {
+ var cafile = path.join(__dirname, "..", "fixtures", "config", "multi-ca")
+
+ npmconf.load({cafile: cafile}, function (er, conf) {
+ if (er) throw er
+
+ t.same(conf.get("cafile"), cafile)
+ t.same(conf.get("ca").join("\n"), fs.readFileSync(cafile, "utf8").trim())
+ t.end()
+ })
+})
diff --git a/node_modules/npmconf/test/credentials.js b/test/tap/config-credentials.js
index d50d496e5..c24bb7e1b 100644
--- a/node_modules/npmconf/test/credentials.js
+++ b/test/tap/config-credentials.js
@@ -1,7 +1,7 @@
var test = require("tap").test
-var npmconf = require("../npmconf.js")
-var common = require("./00-setup.js")
+var npmconf = require("../../lib/config/core.js")
+var common = require("./00-config-setup.js")
var URI = "https://registry.lvh.me:8661/"
@@ -161,12 +161,12 @@ test("get old-style credentials for default registry", function (t) {
npmconf.load(common.builtin, function (er, conf) {
var actual = conf.getCredentialsByURI(conf.get("registry"))
var expected = {
- scope : '//registry.npmjs.org/',
+ scope : "//registry.npmjs.org/",
token : undefined,
- password : 'password',
- username : 'username',
- email : 'i@izs.me',
- auth : 'dXNlcm5hbWU6cGFzc3dvcmQ=',
+ password : "password",
+ username : "username",
+ email : "i@izs.me",
+ auth : "dXNlcm5hbWU6cGFzc3dvcmQ=",
alwaysAuth : false
}
t.same(actual, expected)
diff --git a/test/tap/config-meta.js b/test/tap/config-meta.js
index ddbd6bc6f..faced80d9 100644
--- a/test/tap/config-meta.js
+++ b/test/tap/config-meta.js
@@ -90,7 +90,7 @@ test("get docs", function (t) {
})
test("check configs", function (t) {
- var defs = require("npmconf/config-defs.js")
+ var defs = require("../../lib/config/defaults.js")
var types = Object.keys(defs.types)
var defaults = Object.keys(defs.defaults)
for (var c1 in CONFS) {
diff --git a/test/tap/config-project.js b/test/tap/config-project.js
new file mode 100644
index 000000000..337355bf2
--- /dev/null
+++ b/test/tap/config-project.js
@@ -0,0 +1,66 @@
+var test = require("tap").test
+var path = require("path")
+var fix = path.resolve(__dirname, "..", "fixtures", "config")
+var projectRc = path.resolve(fix, ".npmrc")
+var npmconf = require("../../lib/config/core.js")
+var common = require("./00-config-setup.js")
+
+var projectData = { just: "testing" }
+
+var ucData = common.ucData
+var envData = common.envData
+var envDataFix = common.envDataFix
+
+var gcData = { "package-config:foo": "boo" }
+
+var biData = {}
+
+var cli = { foo: "bar", umask: 022, prefix: fix }
+
+var expectList = [
+ cli,
+ envDataFix,
+ projectData,
+ ucData,
+ gcData,
+ biData
+]
+
+var expectSources = {
+ cli: { data: cli },
+ env: {
+ data: envDataFix,
+ source: envData,
+ prefix: ""
+ },
+ project: {
+ path: projectRc,
+ type: "ini",
+ data: projectData
+ },
+ user: {
+ path: common.userconfig,
+ type: "ini",
+ data: ucData
+ },
+ global: {
+ path: common.globalconfig,
+ type: "ini",
+ data: gcData
+ },
+ builtin: { data: biData }
+}
+
+test("no builtin", function (t) {
+ npmconf.load(cli, function (er, conf) {
+ if (er) throw er
+ t.same(conf.list, expectList)
+ t.same(conf.sources, expectSources)
+ t.same(npmconf.rootConf.list, [])
+ t.equal(npmconf.rootConf.root, npmconf.defs.defaults)
+ t.equal(conf.root, npmconf.defs.defaults)
+ t.equal(conf.get("umask"), 022)
+ t.equal(conf.get("heading"), "npm")
+ t.end()
+ })
+})
diff --git a/test/tap/config-save.js b/test/tap/config-save.js
new file mode 100644
index 000000000..88526a38a
--- /dev/null
+++ b/test/tap/config-save.js
@@ -0,0 +1,88 @@
+var fs = require("fs")
+var ini = require("ini")
+var test = require("tap").test
+var npmconf = require("../../lib/config/core.js")
+var common = require("./00-config-setup.js")
+
+var expectConf = [
+ "globalconfig = " + common.globalconfig,
+ "email = i@izs.me",
+ "env-thing = asdf",
+ "init.author.name = Isaac Z. Schlueter",
+ "init.author.email = i@izs.me",
+ "init.author.url = http://blog.izs.me/",
+ "init.version = 1.2.3",
+ "proprietary-attribs = false",
+ "npm:publishtest = true",
+ "_npmjs.org:couch = https://admin:password@localhost:5984/registry",
+ "npm-www:nocache = 1",
+ "sign-git-tag = false",
+ "message = v%s",
+ "strict-ssl = false",
+ "_auth = dXNlcm5hbWU6cGFzc3dvcmQ=",
+ "",
+ "[_token]",
+ "AuthSession = yabba-dabba-doodle",
+ "version = 1",
+ "expires = 1345001053415",
+ "path = /",
+ "httponly = true",
+ ""
+].join("\n")
+
+var expectFile = [
+ "globalconfig = " + common.globalconfig,
+ "email = i@izs.me",
+ "env-thing = asdf",
+ "init.author.name = Isaac Z. Schlueter",
+ "init.author.email = i@izs.me",
+ "init.author.url = http://blog.izs.me/",
+ "init.version = 1.2.3",
+ "proprietary-attribs = false",
+ "npm:publishtest = true",
+ "_npmjs.org:couch = https://admin:password@localhost:5984/registry",
+ "npm-www:nocache = 1",
+ "sign-git-tag = false",
+ "message = v%s",
+ "strict-ssl = false",
+ "_auth = dXNlcm5hbWU6cGFzc3dvcmQ=",
+ "",
+ "[_token]",
+ "AuthSession = yabba-dabba-doodle",
+ "version = 1",
+ "expires = 1345001053415",
+ "path = /",
+ "httponly = true",
+ ""
+].join("\n")
+
+test("saving configs", function (t) {
+ npmconf.load(function (er, conf) {
+ if (er)
+ throw er
+ conf.set("sign-git-tag", false, "user")
+ conf.del("nodedir")
+ conf.del("tmp")
+ var foundConf = ini.stringify(conf.sources.user.data)
+ t.same(ini.parse(foundConf), ini.parse(expectConf))
+ fs.unlinkSync(common.userconfig)
+ conf.save("user", function (er) {
+ if (er)
+ throw er
+ var uc = fs.readFileSync(conf.get("userconfig"), "utf8")
+ t.same(ini.parse(uc), ini.parse(expectFile))
+ t.end()
+ })
+ })
+})
+
+test("setting prefix", function (t) {
+ npmconf.load(function (er, conf) {
+ if (er)
+ throw er
+
+ conf.prefix = "newvalue"
+ t.same(conf.prefix, "newvalue")
+ t.end()
+ })
+})
diff --git a/test/tap/config-semver-tag.js b/test/tap/config-semver-tag.js
new file mode 100644
index 000000000..4ce1cb219
--- /dev/null
+++ b/test/tap/config-semver-tag.js
@@ -0,0 +1,27 @@
+var util = require("util")
+var test = require("tap").test
+var npmconf = require("../../lib/config/core.js")
+var common = require("./00-config-setup.js")
+
+var cli = { tag: "v2.x" }
+
+var log = require("npmlog")
+
+test("tag cannot be a SemVer", function (t) {
+ var messages = []
+ log.warn = function (m) {
+ messages.push(m + " " + util.format.apply(util, [].slice.call(arguments, 1)))
+ }
+
+ var expect = [
+ 'invalid config tag="v2.x"',
+ "invalid config Tag must not be a SemVer range"
+ ]
+
+ npmconf.load(cli, common.builtin, function (er, conf) {
+ if (er) throw er
+ t.equal(conf.get("tag"), "latest")
+ t.same(messages, expect)
+ t.end()
+ })
+})