diff options
author | isaacs <i@izs.me> | 2011-10-08 04:19:38 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-10-08 04:19:38 +0400 |
commit | 36d0c5d2f3a0c441cd6933fa4a7e2cade7f36b4b (patch) | |
tree | 686e9e45f4ccf523c047b5b6fdbdea643a610d27 /lib | |
parent | a7da3073773277d219a469b52fdfcf2f041eafee (diff) |
Output builtin config values with 'npm config ls'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/config.js b/lib/config.js index 492ad2daa..4e4eac518 100644 --- a/lib/config.js +++ b/lib/config.js @@ -229,6 +229,29 @@ function list (cb) { msg += eol } + // builtin config file + var bconf = ini.configList.list[ini.TRANS.builtin] + , bconfKeys = Object.keys(bconf).filter(function (k) { + return types[k] === types[k] + }).sort(function (a, b) { + return a > b ? 1 : -1 + }) + if (bconfKeys.length) { + var path = require("path") + msg += "; builtin config " + path.resolve(__dirname, "../npmrc") + eol + bconfKeys.forEach(function (k) { + var val = (k.charAt(0) === "_") + ? "---sekretz---" + : JSON.stringify(bconf[k]) + if (bconf[k] !== ini.get(k)) { + if (!long) return + msg += "; " + k + " = " + val + + " (overridden)" + eol + } else msg += k + " = " + val + eol + }) + msg += eol + } + // only show defaults if --long if (!long) { msg += "; node install prefix = " + process.installPrefix + eol |