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.

Developer lists the npm cache of the Node that Zed runs

Țugui Dragoș0348f980ae0e
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 4d56475d..92723377 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -663,6 +663,7 @@ public enum DeveloperCaches {
Definition(id: "zed", name: "Zed", systemImage: "curlybraces", appBundleIdentifiers: ["dev.zed.Zed"], folders: [
Folder("Library/Caches/Zed", .cache, source: "https://github.com/zed-industries/zed/blob/main/crates/paths/src/paths.rs#L192-L199"),
Folder("Library/Logs/Zed", .logs, source: "https://github.com/zed-industries/zed/blob/main/crates/paths/src/paths.rs#L228-L235"),
+ Folder("Library/Application Support/Zed/node/node-*/cache", .cache, source: "https://github.com/zed-industries/zed/blob/main/crates/node_runtime/src/node_runtime.rs#L721-L724"),
Folder("Library/Application Support/Zed/hang_traces", .logs, source: "https://github.com/zed-industries/zed/blob/main/crates/paths/src/paths.rs#L221-L225"),
Folder("Library/Application Support/Zed/remote_servers", .downloads, source: "https://github.com/zed-industries/zed/blob/main/crates/paths/src/paths.rs#L474-L478"),
Folder("Library/Application Support/Zed/languages", .environments, source: "https://github.com/zed-industries/zed/blob/main/crates/paths/src/paths.rs#L438-L444"),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 0f5d5acb..a1128d0f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -844,6 +844,18 @@ struct DeveloperCachesTests {
])
}
+ @Test func offersTheNpmCacheOfZedsNodeAndNeverTheNodeItself() async throws {
+ let directory = try TemporaryDirectory()
+ let node = "Library/Application Support/Zed/node/node-v24.11.0-darwin-arm64"
+ try directory.file("\(node)/cache/_cacache/index-v5/00/data", bytes: 400_000)
+ try directory.file("\(node)/bin/node", bytes: 400_000)
+ let zed = DeveloperCaches.definitions.filter { $0.id == "zed" }
+
+ let locations = await DeveloperCaches.scan(zed, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map { $0.url.path(percentEncoded: false).hasSuffix("\(node)/cache") } == [true])
+ }
+
/// virtualenvwrapper keeps the user's hook scripts beside the environments in `~/.virtualenvs`, so only the
/// environments are offered, and a link among them is left where it is, never followed.
@Test func offersVirtualenvwrappersEnvironmentsAndNotItsHooks() async throws {