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:
authorSpain Train <michael.spainhower@opower.com>2013-11-02 05:38:00 +0400
committerisaacs <i@izs.me>2013-11-04 23:58:47 +0400
commit33dd4ed6b4ff7960683e53087c9634d7f02661c4 (patch)
tree1d945051ffb225450bfa6164dc6b2f36cd38de5a
parentbaafe15bd1568b7d75923a0abb2934e6f8bca3fd (diff)
#4030 Config edit escape sequences
* Used ini.stringify to output default values in npm.config.edit Closes #4030 Closes #3782
-rw-r--r--lib/config.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/config.js b/lib/config.js
index 12879440e..7d9776379 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -83,9 +83,17 @@ function edit (cb) {
, ";;;;"
]
)
- .concat(Object.keys(npmconf.defaults).map(function (k) {
- return "; " + k + " = " + npmconf.defaults[k]
- }))
+ .concat(Object.keys(npmconf.defaults).reduce(function (arr, key) {
+ var obj = {};
+ obj[key] = npmconf.defaults[key]
+ if (key === "logstream") return arr
+ return arr.concat(
+ ini.stringify(obj)
+ .replace(/\n$/m, '')
+ .replace(/^/g, '; ')
+ .replace(/\n/g, '\n; ')
+ .split('\n'))
+ }, []))
.concat([""])
.join(os.EOL)
fs.writeFile