Skip to content

Commit

Permalink
fix(@angular/cli): don't resolve .npmrc from parent directories
Browse files Browse the repository at this point in the history
Unlike `yarn`, `npm` doesn't resolve `.npmrc` from parent locations instead it looks in predefied locations in
- per-project config file (/path/to/my/project/.npmrc)
- per-user config file (~/.npmrc)
- global config file ($PREFIX/etc/npmrc)
- npm builtin config file (/path/to/npm/npmrc)

https://docs.npmjs.com/cli/v7/configuring-npm/npmrc#files
  • Loading branch information
alan-agius4 authored and clydin committed Jun 16, 2021
1 parent 77c96f8 commit e9717e5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/angular/cli/utilities/package-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ function readOptions(
];

const projectConfigLocations: string[] = [path.join(cwd, dotFilename)];
const root = path.parse(cwd).root;
for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) {
projectConfigLocations.unshift(path.join(curDir, dotFilename));
if (yarn) {
const root = path.parse(cwd).root;
for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) {
projectConfigLocations.unshift(path.join(curDir, dotFilename));
}
}

if (showPotentials) {
Expand Down

0 comments on commit e9717e5

Please sign in to comment.