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>2011-01-18 04:42:41 +0300
committerisaacs <i@izs.me>2011-01-18 04:42:41 +0300
commite942a71a9928dfcf3b643b77c211faee82b7d1e8 (patch)
tree7b538758e544d93e1e6a44bbd8dd0271f7952ac4
parent0cec5bf273d16933c3c61ada8c0b4a135688db16 (diff)
Fix #509. Don't read defaults from non-package folders.
-rw-r--r--lib/utils/read-json.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/utils/read-json.js b/lib/utils/read-json.js
index 5cb7a2b2b..c83465b3d 100644
--- a/lib/utils/read-json.js
+++ b/lib/utils/read-json.js
@@ -36,6 +36,10 @@ function readJson (jsonFile, opts, cb) {
else opts.wscript = data.toString().match(/(^|\n)def build\b/)
&& data.toString().match(/(^|\n)def configure\b/)
fs.readFile(jsonFile, processJson(opts, function (er, data) {
+ if (er) return cb(er)
+ var doLoad = !(jsonFile.indexOf(npm.cache) === 0 &&
+ path.basename(path.dirname(jsonFile)) !== "package")
+ if (!doLoad) return cb(er, data)
loadPackageDefaults(data, path.dirname(jsonFile), cb)
}))
})