Skip to content

Commit 8784732

Browse files
committed
Added ability to load .npmrc anywhere from cwd and up
Fixes #81 TODO: add tests
1 parent a070fce commit 8784732

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/registries/npm.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export default class NpmRegistry extends Registry {
4848
path.join(userHome, ".npmrc"),
4949
path.join(this.cwd, ".npmrc"),
5050
];
51+
let foldersFromRootToCwd = this.cwd.split(path.sep);
52+
while (foldersFromRootToCwd.length > 1) {
53+
possibles.push(path.join(foldersFromRootToCwd.join(path.sep), ".npmrc"));
54+
foldersFromRootToCwd.pop();
55+
}
5156

5257
this.mergeEnv("npm_config_");
5358

0 commit comments

Comments
 (0)