Skip to content

Commit

Permalink
revert: use the same directories on macOS as on Linux
Browse files Browse the repository at this point in the history
This reverts commit b970d96.
  • Loading branch information
gluxon committed Mar 30, 2024
1 parent 6caec81 commit d40f3ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
6 changes: 0 additions & 6 deletions .changeset/silly-moles-rhyme.md

This file was deleted.

11 changes: 10 additions & 1 deletion config/config/src/dirs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export function getCacheDir (
if (opts.env.XDG_CACHE_HOME) {
return path.join(opts.env.XDG_CACHE_HOME, 'pnpm')
}
if (opts.platform === 'darwin') {
return path.join(os.homedir(), 'Library/Caches/pnpm')
}
if (opts.platform !== 'win32') {
return path.join(os.homedir(), '.cache/pnpm')
}
Expand All @@ -28,7 +31,7 @@ export function getStateDir (
if (opts.env.XDG_STATE_HOME) {
return path.join(opts.env.XDG_STATE_HOME, 'pnpm')
}
if (opts.platform !== 'win32') {
if (opts.platform !== 'win32' && opts.platform !== 'darwin') {
return path.join(os.homedir(), '.local/state/pnpm')
}
if (opts.env.LOCALAPPDATA) {
Expand All @@ -49,6 +52,9 @@ export function getDataDir (
if (opts.env.XDG_DATA_HOME) {
return path.join(opts.env.XDG_DATA_HOME, 'pnpm')
}
if (opts.platform === 'darwin') {
return path.join(os.homedir(), 'Library/pnpm')
}
if (opts.platform !== 'win32') {
return path.join(os.homedir(), '.local/share/pnpm')
}
Expand All @@ -67,6 +73,9 @@ export function getConfigDir (
if (opts.env.XDG_CONFIG_HOME) {
return path.join(opts.env.XDG_CONFIG_HOME, 'pnpm')
}
if (opts.platform === 'darwin') {
return path.join(os.homedir(), 'Library/Preferences/pnpm')
}
if (opts.platform !== 'win32') {
return path.join(os.homedir(), '.config/pnpm')
}
Expand Down
8 changes: 4 additions & 4 deletions config/config/test/dirs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('getCacheDir()', () => {
expect(getCacheDir({
env: {},
platform: 'darwin',
})).toBe(path.join(os.homedir(), '.cache/pnpm'))
})).toBe(path.join(os.homedir(), 'Library/Caches/pnpm'))
expect(getCacheDir({
env: {
LOCALAPPDATA: '/localappdata',
Expand All @@ -43,7 +43,7 @@ test('getStateDir()', () => {
expect(getStateDir({
env: {},
platform: 'darwin',
})).toBe(path.join(os.homedir(), '.local/state/pnpm'))
})).toBe(path.join(os.homedir(), '.pnpm-state'))
expect(getStateDir({
env: {
LOCALAPPDATA: '/localappdata',
Expand Down Expand Up @@ -76,7 +76,7 @@ test('getDataDir()', () => {
expect(getDataDir({
env: {},
platform: 'darwin',
})).toBe(path.join(os.homedir(), '.local/share/pnpm'))
})).toBe(path.join(os.homedir(), 'Library/pnpm'))
expect(getDataDir({
env: {
LOCALAPPDATA: '/localappdata',
Expand All @@ -103,7 +103,7 @@ test('getConfigDir()', () => {
expect(getConfigDir({
env: {},
platform: 'darwin',
})).toBe(path.join(os.homedir(), '.config/pnpm'))
})).toBe(path.join(os.homedir(), 'Library/Preferences/pnpm'))
expect(getConfigDir({
env: {
LOCALAPPDATA: '/localappdata',
Expand Down

0 comments on commit d40f3ea

Please sign in to comment.