From 87b01ffd6aad45f3543a31e30f67b5b01a13b77e Mon Sep 17 00:00:00 2001 From: Adam Vigneaux Date: Tue, 27 Aug 2019 14:02:50 -0400 Subject: [PATCH] feat(@angular/cli): add support for custom npmrc paths According to [the npm config docs](https://docs.npmjs.com/misc/config#npmrc-files), a user can specify the path to their `npmrc` files using the environment variables `NPM_CONFIG_USERCONFIG` and `NPM_CONFIG_GLOBALCONFIG`. When set, these variables should override the default paths. --- packages/angular/cli/utilities/package-metadata.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/angular/cli/utilities/package-metadata.ts b/packages/angular/cli/utilities/package-metadata.ts index 26b3f446b135..942fe5412579 100644 --- a/packages/angular/cli/utilities/package-metadata.ts +++ b/packages/angular/cli/utilities/package-metadata.ts @@ -91,8 +91,8 @@ function readOptions( } const defaultConfigLocations = [ - path.join(globalPrefix, 'etc', baseFilename), - path.join(homedir(), dotFilename), + (!yarn && process.env.NPM_CONFIG_GLOBALCONFIG) || path.join(globalPrefix, 'etc', baseFilename), + (!yarn && process.env.NPM_CONFIG_USERCONFIG) || path.join(homedir(), dotFilename), ]; const projectConfigLocations: string[] = [