Skip to content

Commit

Permalink
yarnrc: respect XDG_CONFIG_HOME setting
Browse files Browse the repository at this point in the history
If a user has a XDG_CONFIG_HOME environment variable, read and write
the yarnrc file from XDG_CONFIG_HOME/.yarnrc, not from $HOME/.yarnrc.

The specification can be found here:
https://wiki.archlinux.org/index.php/XDG_Base_Directory_support

Fixes yarnpkg#2334.
  • Loading branch information
kevinburke committed Mar 27, 2017
1 parent fb1d128 commit ff197b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/registries/yarn-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export default class YarnRegistry extends NpmRegistry {
constructor(cwd: string, registries: ConfigRegistries, requestManager: RequestManager) {
super(cwd, registries, requestManager);

this.homeConfigLoc = path.join(userHome, '.yarnrc');
if (process.env.XDG_CONFIG_HOME) {
this.homeConfigLoc = path.join(process.env.XDG_CONFIG_HOME, '.yarnrc');
} else {
this.homeConfigLoc = path.join(userHome, '.yarnrc');
}
this.homeConfig = {};
}

Expand Down

0 comments on commit ff197b9

Please sign in to comment.