summaryrefslogtreecommitdiff
blob: e7346b826852bf1527fca89c01f87d46ef2e2789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
commit 46ac7cd4229eac5e0182ab62b7ed844c24a8c52e
Author: Johan Bergström <bugs@bergstroem.nu>
Date:   Wed Feb 10 22:45:59 2016 +1100

    npm: set global config folder to /etc/npm
    
    npm previously assumed that the global config path would be
    based on $prefix/etc. Since gentoo installs nodejs into /usr,
    this means we're also creating /usr/etc which is less desirable.
    
    This patch will likely never go upstream.

diff --git a/deps/npm/lib/config/core.js b/deps/npm/lib/config/core.js
index d1306eb..bd2ef89 100644
--- a/deps/npm/lib/config/core.js
+++ b/deps/npm/lib/config/core.js
@@ -150,16 +150,14 @@ function load_ (builtin, rc, cli, cb) {
     // Eg, `npm config get globalconfig --prefix ~/local` should
     // return `~/local/etc/npmrc`
     // annoying humans and their expectations!
-    if (conf.get('prefix')) {
-      var etc = path.resolve(conf.get('prefix'), 'etc')
-      mkdirp(etc, function () {
-        defaults.globalconfig = path.resolve(etc, 'npmrc')
-        defaults.globalignorefile = path.resolve(etc, 'npmignore')
-        afterUserContinuation()
-      })
-    } else {
+
+    // gentoo deviates wrt global config; store in /etc/npm
+    var globalconfig = path.resolve('/etc', 'npm')
+    mkdirp(globalconfig, function () {
+      defaults.globalconfig = path.resolve(globalconfig, 'npmrc')
+      defaults.globalignorefile = path.resolve(globalconfig, 'npmignore')
       afterUserContinuation()
-    }
+    })
   }
 
   function afterUserContinuation () {