Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Yarn's global cache is listed and never selected

Țugui Dragoș823f68497d21
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index fff08a25..609a9fa2 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -116,7 +116,9 @@ public enum DeveloperCaches {
]),
Definition(id: "yarn", name: "Yarn", systemImage: "cube", appBundleIdentifiers: [], paths: [
("Library/Caches/Yarn", .downloads),
- (".yarn/berry/cache", .downloads),
+ // Yarn's Plug'n'Play projects load every package from this cache, so it is listed and never selected:
+ // moving it breaks each such project until `yarn install` runs in it again.
+ (".yarn/berry/cache", .environments),
]),
Definition(id: "pnpm", name: "pnpm", systemImage: "cube", appBundleIdentifiers: [], paths: [
("Library/pnpm/store", .environments),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 7a667c65..7c3c9e93 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -268,17 +268,19 @@ struct DeveloperCachesTests {
}
/// A store that installed packages link into is not a download cache. In setups that conda, uv, and pnpm
- /// document, clearing it leaves every installed package linking to nothing.
+ /// document, clearing it leaves every installed package linking to nothing, and Yarn's Plug'n'Play projects
+ /// load every package from its global cache.
@Test func neverSelectsAStoreInstalledPackagesLinkInto() async throws {
let directory = try TemporaryDirectory()
try directory.file("miniconda3/pkgs/numpy/info.json", bytes: 400_000)
try directory.file(".cache/uv/archive-v0/wheel", bytes: 400_000)
try directory.file("Library/pnpm/store/v10/files/00/abc", bytes: 400_000)
try directory.file("Library/Caches/pnpm/metadata/registry.json", bytes: 400_000)
+ try directory.file(".yarn/berry/cache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip", bytes: 400_000)
let locations = await DeveloperCaches.scan(homeDirectory: directory.url).flatMap(\.locations)
let suggested = locations.filter(\.isRecommended).map(\.url).map { $0.lastPathComponent }
- #expect(locations.count == 4)
+ #expect(locations.count == 5)
#expect(suggested == ["pnpm"], "a store installed packages link into was suggested")
}