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-27 01:17:48 +0400
committerisaacs <i@izs.me>2014-06-27 01:22:51 +0400
commita964fe1a3bf3fb617c396fe508c531f6dfcc628f (patch)
tree41eab28b21e2efacfc954aecf884c701fe3e771f
parent56d9e5ce052dc5b96e65997ff88ca1944f707be1 (diff)
Consolidate color sniffing in config/log loading process
-rw-r--r--lib/npm.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/npm.js b/lib/npm.js
index 34df1c233..c7288e2b7 100644
--- a/lib/npm.js
+++ b/lib/npm.js
@@ -336,20 +336,14 @@ function load (npm, cli, cb) {
log.level = config.get("loglevel")
log.heading = config.get("heading") || "npm"
log.stream = config.get("logstream")
- switch (color) {
- case "always": log.enableColor(); break
- case false: log.disableColor(); break
- }
- log.resume()
- if (er) return cb(er)
-
- // see if we need to color normal output
switch (color) {
case "always":
+ log.enableColor()
npm.color = true
break
case false:
+ log.disableColor()
npm.color = false
break
default:
@@ -361,6 +355,8 @@ function load (npm, cli, cb) {
break
}
+ log.resume()
+
// at this point the configs are all set.
// go ahead and spin up the registry client.
npm.registry = new RegClient(npm.config)
@@ -376,7 +372,7 @@ function load (npm, cli, cb) {
var lp = Object.getOwnPropertyDescriptor(config, "localPrefix")
Object.defineProperty(npm, "localPrefix", lp)
- return cb()
+ return cb(null, npm)
})
})
}