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:
authorisaacs <i@izs.me>2014-06-28 02:05:09 +0400
committerisaacs <i@izs.me>2014-06-28 02:05:09 +0400
commit91733e288170fb50db631d55f9dfd33b60820b7d (patch)
treea27ed44b7180bdf445d303219be212e6208868d7
parent4932583a1db6066298c1110f50737431d4eab9e9 (diff)
npmconf@1.1.2
-rw-r--r--node_modules/npmconf/config-defs.js4
-rw-r--r--node_modules/npmconf/lib/load-prefix.js17
-rw-r--r--node_modules/npmconf/npmconf.js19
-rw-r--r--node_modules/npmconf/package.json32
-rw-r--r--node_modules/npmconf/test/00-setup.js13
-rw-r--r--node_modules/npmconf/test/basic.js4
-rw-r--r--node_modules/npmconf/test/builtin.js4
-rw-r--r--node_modules/npmconf/test/project.js4
-rw-r--r--node_modules/npmconf/test/save.js10
-rw-r--r--package.json2
10 files changed, 81 insertions, 28 deletions
diff --git a/node_modules/npmconf/config-defs.js b/node_modules/npmconf/config-defs.js
index e0679b8ba..02425a1da 100644
--- a/node_modules/npmconf/config-defs.js
+++ b/node_modules/npmconf/config-defs.js
@@ -192,7 +192,7 @@ Object.defineProperty(exports, "defaults", {get: function () {
, "save-exact" : false
, "save-optional" : false
, "save-prefix": "^"
- // , scope : ""
+ //, scope : ""
, searchopts: ""
, searchexclude: null
, searchsort: "name"
@@ -298,7 +298,7 @@ exports.types =
, "save-exact" : Boolean
, "save-optional" : Boolean
, "save-prefix": String
- // , scope : String
+ //, scope : String
, searchopts : String
, searchexclude: [null, String]
, searchsort: [ "name", "-name"
diff --git a/node_modules/npmconf/lib/load-prefix.js b/node_modules/npmconf/lib/load-prefix.js
index 8d97fcf84..bb39d9c98 100644
--- a/node_modules/npmconf/lib/load-prefix.js
+++ b/node_modules/npmconf/lib/load-prefix.js
@@ -1,22 +1,28 @@
module.exports = loadPrefix
var findPrefix = require("./find-prefix.js")
-var mkdirp = require("mkdirp")
var path = require('path')
function loadPrefix (cb) {
var cli = this.list[0]
Object.defineProperty(this, "prefix",
- { get : function () {
+ { set : function (prefix) {
+ var g = this.get("global")
+ this[g ? 'globalPrefix' : 'localPrefix'] = prefix
+ }.bind(this)
+ , get : function () {
var g = this.get("global")
return g ? this.globalPrefix : this.localPrefix
}.bind(this)
- , enmerable : true
+ , enumerable : true
})
Object.defineProperty(this, "globalPrefix",
- { get : function () {
+ { set : function (prefix) {
+ this.set('prefix', prefix)
+ }.bind(this)
+ , get : function () {
return path.resolve(this.get("prefix"))
}.bind(this)
, enumerable : true
@@ -24,7 +30,8 @@ function loadPrefix (cb) {
var p
Object.defineProperty(this, "localPrefix",
- { get : function () { return p }
+ { set : function (prefix) { p = prefix },
+ get : function () { return p }
, enumerable: true })
// try to guess at a good node_modules location.
diff --git a/node_modules/npmconf/npmconf.js b/node_modules/npmconf/npmconf.js
index d1f334b79..398a532bf 100644
--- a/node_modules/npmconf/npmconf.js
+++ b/node_modules/npmconf/npmconf.js
@@ -274,9 +274,12 @@ Conf.prototype.save = function (where, cb) {
this._saving ++
var mode = where === 'user' ? 0600 : 0666
- if (!data.trim())
- fs.unlink(target.path, done)
- else {
+ if (!data.trim()) {
+ fs.unlink(target.path, function (er) {
+ // ignore the possible error (e.g. the file doesn't exist)
+ done(null)
+ })
+ } else {
mkdirp(path.dirname(target.path), function (er) {
if (er)
return then(er)
@@ -349,14 +352,16 @@ Conf.prototype.addEnv = function (env) {
env = env || process.env
var conf = {}
Object.keys(env)
- .filter(function (k) { return k.match(/^npm_config_[^_]/i) })
+ .filter(function (k) { return k.match(/^npm_config_/i) })
.forEach(function (k) {
if (!env[k])
return
- conf[k.replace(/^npm_config_/i, '')
- .toLowerCase()
- .replace(/_/g, '-')] = env[k]
+ // leave first char untouched, even if
+ // it is a "_" - convert all other to "-"
+ var p = k.replace(/^npm_config_/, '')
+ .replace(/(?!^)_/g, '-')
+ conf[p] = env[k]
})
return CC.prototype.addEnv.call(this, '', conf, 'env')
}
diff --git a/node_modules/npmconf/package.json b/node_modules/npmconf/package.json
index c2f77e73f..4b0e28f9e 100644
--- a/node_modules/npmconf/package.json
+++ b/node_modules/npmconf/package.json
@@ -1,6 +1,6 @@
{
"name": "npmconf",
- "version": "1.1.1",
+ "version": "1.1.2",
"description": "The config thing npm uses",
"main": "npmconf.js",
"directories": {
@@ -40,14 +40,32 @@
"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": "f56051d91a964daf547a57096348d00721c289bf",
+ "gitHead": "6649ff293d764a3343414a3906168c806668f974",
"bugs": {
"url": "https://github.com/isaacs/npmconf/issues"
},
"homepage": "https://github.com/isaacs/npmconf",
- "_id": "npmconf@1.1.1",
- "_shasum": "5fa85daf4655e059753d0dcd281763fa8e32545a",
- "_from": "npmconf@latest"
+ "_id": "npmconf@1.1.2",
+ "_shasum": "65d3775f77653786fb5a112e17df5272ff3955fd",
+ "_from": "npmconf@1.1.2",
+ "_npmVersion": "1.4.16",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
+ }
+ ],
+ "dist": {
+ "shasum": "65d3775f77653786fb5a112e17df5272ff3955fd",
+ "tarball": "http://registry.npmjs.org/npmconf/-/npmconf-1.1.2.tgz"
+ },
+ "_resolved": "https://registry.npmjs.org/npmconf/-/npmconf-1.1.2.tgz"
}
diff --git a/node_modules/npmconf/test/00-setup.js b/node_modules/npmconf/test/00-setup.js
index 79cbbb127..27e106915 100644
--- a/node_modules/npmconf/test/00-setup.js
+++ b/node_modules/npmconf/test/00-setup.js
@@ -14,6 +14,19 @@ Object.keys(process.env).forEach(function (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'
+
+exports.envData = {
+ userconfig: exports.userconfig,
+ '_underbar-env-thing': 'underful',
+ 'other-env-thing': '1000'
+}
+exports.envDataFix = {
+ userconfig: exports.userconfig,
+ '_underbar-env-thing': 'underful',
+ 'other-env-thing': 1000,
+}
+
if (module === require.main) {
// set the globalconfig in the userconfig
diff --git a/node_modules/npmconf/test/basic.js b/node_modules/npmconf/test/basic.js
index f17f0fb8e..29d708b3a 100644
--- a/node_modules/npmconf/test/basic.js
+++ b/node_modules/npmconf/test/basic.js
@@ -31,8 +31,8 @@ var ucData =
path: '/',
httponly: true } }
-var envData = { userconfig: common.userconfig, 'other-env-thing': '1000' }
-var envDataFix = { userconfig: common.userconfig, 'other-env-thing': 1000 }
+var envData = common.envData
+var envDataFix = common.envDataFix
var gcData = { 'package-config:foo': 'boo' }
diff --git a/node_modules/npmconf/test/builtin.js b/node_modules/npmconf/test/builtin.js
index 0a305d2a6..15cb9083a 100644
--- a/node_modules/npmconf/test/builtin.js
+++ b/node_modules/npmconf/test/builtin.js
@@ -29,8 +29,8 @@ var ucData =
path: '/',
httponly: true } }
-var envData = { userconfig: common.userconfig, 'other-env-thing': '1000' }
-var envDataFix = { userconfig: common.userconfig, 'other-env-thing': 1000 }
+var envData = common.envData
+var envDataFix = common.envDataFix
var gcData = { 'package-config:foo': 'boo' }
diff --git a/node_modules/npmconf/test/project.js b/node_modules/npmconf/test/project.js
index 04e063855..fa21e43d2 100644
--- a/node_modules/npmconf/test/project.js
+++ b/node_modules/npmconf/test/project.js
@@ -33,8 +33,8 @@ var ucData =
path: '/',
httponly: true } }
-var envData = { userconfig: common.userconfig, 'other-env-thing': '1000' }
-var envDataFix = { userconfig: common.userconfig, 'other-env-thing': 1000 }
+var envData = common.envData
+var envDataFix = common.envDataFix
var gcData = { 'package-config:foo': 'boo' }
diff --git a/node_modules/npmconf/test/save.js b/node_modules/npmconf/test/save.js
index 05230cd0a..64b114449 100644
--- a/node_modules/npmconf/test/save.js
+++ b/node_modules/npmconf/test/save.js
@@ -72,3 +72,13 @@ test('saving configs', function (t) {
})
})
+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/package.json b/package.json
index 64c8ff85f..e175775b9 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,7 @@
"npm-install-checks": "~1.0.2",
"npm-registry-client": "~2.0.2",
"npm-user-validate": "~0.1.0",
- "npmconf": "~1.1.1",
+ "npmconf": "~1.1.2",
"npmlog": "~0.1.1",
"once": "~1.3.0",
"opener": "~1.3.0",