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 prebuilt native modules kept in npm's folder

Țugui Dragoșc39bfa9c513d
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 77f088e4..43732e39 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -301,6 +301,7 @@ public enum DeveloperCaches {
Folder(".npm/_cacache", .downloads, source: "https://github.com/npm/cli/blob/latest/workspaces/config/lib/definitions/definitions.js#L443"),
Folder(".npm/_npx", .downloads, source: "https://github.com/npm/cli/blob/latest/workspaces/config/lib/definitions/definitions.js#L444"),
Folder(".npm/_logs", .logs, source: "https://github.com/npm/cli/blob/latest/workspaces/config/lib/definitions/definitions.js#L1481-L1486"),
+ Folder(".npm/_prebuilds", .downloads, source: "https://github.com/prebuild/prebuild-install/blob/master/README.md#L148-L154"),
]),
Definition(id: "yarn", name: "Yarn", systemImage: "cube", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/Yarn", .downloads, source: "https://github.com/yarnpkg/yarn/blob/master/src/util/user-dirs.js#L32-L33"),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 32735cea..79c0aa7f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -675,6 +675,17 @@ struct DeveloperCachesTests {
#expect(Set(offered.map(\.url.lastPathComponent)) == ["glide_home", "api-source", "gh-actions-artifact", "go_cache"])
}
+ @Test func offersThePrebuiltBinariesNativeModulesDownloadedIntoNpmsFolder() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file(".npm/_prebuilds/b1f2-better-sqlite3-v12.0.0-node-v137-darwin-arm64.tar.gz", bytes: 400_000)
+ let npm = DeveloperCaches.definitions.filter { $0.id == "npm" }
+
+ let locations = await DeveloperCaches.scan(npm, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map(\.url.lastPathComponent) == ["_prebuilds"])
+ #expect(locations.first?.isRecommended == 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 {