Skip to content

Commit

Permalink
fix(config): default home directory on macOS
Browse files Browse the repository at this point in the history
ref #2574
  • Loading branch information
zkochan committed Aug 18, 2021
1 parent 717b042 commit 0fb1d7d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-clouds-care.md
@@ -0,0 +1,5 @@
---
"@pnpm/config": patch
---

The default home directory for pnpm on macOS should be at `~/Library/pnpm`.
5 changes: 4 additions & 1 deletion packages/config/src/dirs.ts
Expand Up @@ -49,7 +49,10 @@ export function getDataDir (
if (opts.env.XDG_DATA_HOME) {
return path.join(opts.env.XDG_DATA_HOME, 'pnpm')
}
if (opts.platform !== 'win32' && opts.platform !== 'darwin') {
if (opts.platform === 'darwin') {
return path.join(os.homedir(), 'Library/pnpm')
}
if (opts.platform !== 'win32') {
return path.join(os.homedir(), '.local/share/pnpm')
}
if (opts.env.LOCALAPPDATA) {
Expand Down
2 changes: 1 addition & 1 deletion packages/config/test/dirs.test.ts
Expand Up @@ -70,7 +70,7 @@ test('getDataDir()', () => {
expect(getDataDir({
env: {},
platform: 'darwin',
})).toBe(path.join(os.homedir(), '.pnpm'))
})).toBe(path.join(os.homedir(), 'Library/pnpm'))
expect(getDataDir({
env: {
LOCALAPPDATA: '/localappdata',
Expand Down

0 comments on commit 0fb1d7d

Please sign in to comment.