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
path: root/npm.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-03-01 22:16:01 +0300
committerisaacs <i@izs.me>2011-03-22 01:55:27 +0300
commit48c98ace090c18a341e833ba3e11cd10ca62d01c (patch)
tree34ff145adcf26b4e74969cca457d63bcf8779197 /npm.js
parenta221126a5f775dc7e21c28b9dd6543b1f789fbe0 (diff)
Config changes.
{root,binroot,manroot} --> prefix cache folder --> cache tmp folder --> tmp
Diffstat (limited to 'npm.js')
-rw-r--r--npm.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/npm.js b/npm.js
index 41841459a..25348826a 100644
--- a/npm.js
+++ b/npm.js
@@ -132,6 +132,9 @@ npm.load = function (conf, cb_) {
loading = true
var onload = true
function cb (er) {
+ if (!npm.config.get("global")) {
+ npm.config.set("prefix", process.getcwd())
+ }
loaded = true
loadListeners.forEach(function (cb) {
process.nextTick(function () { cb(er, npm) })
@@ -171,28 +174,25 @@ npm.config =
, del : function (key, val) { return ini.del(key, val, "cli") }
}
-Object.defineProperty(npm, "root",
- { get : function () { return npm.config.get("root") }
- , set : function (r) {
- r = r.charAt(0) === "/" ? r
- : path.join(process.execPath, "..", "..", r)
- return npm.config.set("root", r)
- }
+Object.defineProperty(npm, "prefix",
+ { get : function () { return npm.config.get("prefix") }
+ , set : function (r) { return npm.config.set("prefix", r) }
, enumerable : true
})
Object.defineProperty(npm, "dir",
- { get : function () { return path.join(npm.root, npm.config.get('dotnpm')) }
+ { get : function () { return path.resolve(npm.prefix, "node_modules") }
, enumerable : true
})
Object.defineProperty(npm, "cache",
- { get : function () { return path.join(npm.root, npm.config.get('dotnpm'), ".cache") }
+ { get : function () { return npm.config.get("cache") }
+ , set : function (r) { return npm.config.set("cache", r) }
, enumerable : true
})
var tmpFolder
Object.defineProperty(npm, "tmp",
{ get : function () {
if (!tmpFolder) tmpFolder = "npm-"+Date.now()
- return path.join(npm.config.get("tmproot"), tmpFolder)
+ return path.resolve(npm.config.get("tmp"), tmpFolder)
}
, enumerable : true
})