Skip to content

Commit

Permalink
Fixed config resolution (#1024)
Browse files Browse the repository at this point in the history
  • Loading branch information
TAGraves authored and Sebastian McKenzie committed Oct 15, 2016
1 parent 965811c commit 73251d4
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/registries/yarn-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,22 @@ export default class YarnRegistry extends NpmRegistry {
homeConfig: Object;

getOption(key: string): mixed {
let val = this.config[key] || this.registries.npm.getOption(npmMap[key]);
let val = this.config[key];

// if we have no yarn option for this or have used a default then use the npm
// value if it exists
if (!val || val === DEFAULTS[key]) {
val = this.registries.npm.getOption(key) || val;
// if this isn't set in a yarn config, then use npm
if (typeof val === 'undefined') {
val = this.registries.npm.getOption(npmMap[key]);
}

if (typeof val === 'undefined') {
val = this.registries.npm.getOption(key);
}

// if this isn't set in a yarn config or npm config, then use the default (or undefined)
if (typeof val === 'undefined') {
val = DEFAULTS[key];
}

return val;
}

Expand Down

0 comments on commit 73251d4

Please sign in to comment.