revert: use the same directories on macOS as on Linux (#7842)

* revert: use the same directories on macOS as on Linux

This reverts commit b970d96551.

* docs: revert changesets

* feat!: change state directory on macOS

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
Brandon Cheng
2024-03-31 15:33:36 -04:00
committed by GitHub
parent 6caec8109b
commit 2d9e3b81ed
5 changed files with 18 additions and 10 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": major
"pnpm": major
---
Use the same directory for state files on macOS as on Linux (`~/.local/state/pnpm`).

View File

@@ -1,6 +0,0 @@
---
"@pnpm/config": major
"pnpm": major
---
Use the same directories on macOS as on Linux. Don't use directories inside `~/Library` on macOS [#7321](https://github.com/pnpm/pnpm/issues/7321).

View File

@@ -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')
}
@@ -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')
}
@@ -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')
}

View File

@@ -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',
@@ -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',
@@ -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',

View File

@@ -9,7 +9,6 @@
- Support for lockfile v5 is dropped. Use pnpm v8 to convert lockfile v5 to lockfile v6 [#7470](https://github.com/pnpm/pnpm/pull/7470).
- The [`dedupe-injected-deps`](https://pnpm.io/npmrc#dedupe-injected-deps) setting is `true` by default.
- The default value of the `link-workspace-packages` setting changed from `true` to `false`. This means that by default, dependencies will be linked from workspace packages only when they are specified using the [workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace).
- Use the same directories on macOS as on Linux. Don't use directories inside `~/Library` on macOS [#7321](https://github.com/pnpm/pnpm/issues/7321).
- The default value of the [hoist-workspace-packages](https://pnpm.io/npmrc#hoist-workspace-packages) is `true`.
- `pnpm licenses list` prints license information of all versions of the same package in case different versions use different licenses. The format of the `pnpm licenses list --json` output has been changed [#7528](https://github.com/pnpm/pnpm/pull/7528).
- A new command added for printing completion code to the console: `pnpm completion [shell]`. The old command that modified the user's shell dotfiles has been removed [#3083](https://github.com/pnpm/pnpm/issues/3083).