fix(config): default home directory on macOS (#3684)

ref #2574
This commit is contained in:
Zoltan Kochan authored and GitHub committed 2021-08-19 00:43:59 +03:00
1 parent 717b0426c2
commit 655af55baf
3 files changed
+10 -2

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@pnpm/config": patch
---
The default home directory for pnpm on macOS should be at `~/Library/pnpm`.
+4 -1
View File
@@ -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) {
+1 -1
View File
@@ -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',