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.

List the Electron downloads electron-download kept in ~/.electron

Țugui Dragoșaa694ebc994f
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index eb52967d..61826078 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -547,6 +547,8 @@ public enum DeveloperCaches {
Folder("Library/Caches/electron", .downloads, source: "https://github.com/electron/get/blob/53178fdcbd62f0e229a4f9695632003637c0f35e/README.md#L123"),
Folder("Library/Caches/electron-builder", .downloads, source: "https://github.com/electron-userland/electron-builder/blob/ec9135d0626879479ffa4235006f06b14375cc43/website/docs/environment-variables.md#L166"),
Folder(".electron-gyp", .downloads, source: "https://github.com/electron/rebuild/blob/8b14ce89664a4d341afebb0e5964e912d4453b7f/src/constants.ts#L4"),
+ // The cache older versions of electron-download used, before `@electron/get` replaced it.
+ Folder(".electron", .downloads, source: "https://unpkg.com/[email protected]/lib/index.js"),
]),
Definition(id: "nodegyp", name: "node-gyp", systemImage: "cube", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/node-gyp", .downloads, source: "https://github.com/nodejs/node-gyp/blob/399f6faedf5abc1eb791678e0a03a91d3fef12aa/bin/node-gyp.js#L25"),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 699a38f8..a1eee546 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -403,7 +403,7 @@ struct DeveloperCachesTests {
let ownedOutright: Set<String> = [
".ccache", ".electron-gyp", ".gitlibs", ".node-gyp", ".virtualenvs", "nltk_data", "tensorflow_datasets",
".zcompdump*", ".pnpm-store", "playwright_*dev_profile-*/", "playwright-artifacts-*/", "metro-cache/",
- "metro-file-map-*", "node-compile-cache/", "tfhub_modules/",
+ "metro-file-map-*", "node-compile-cache/", "tfhub_modules/", ".electron",
]
for definition in DeveloperCaches.definitions {
for path in definition.folders.map(\.path) {
@@ -1303,6 +1303,18 @@ struct DeveloperCachesTests {
#expect(locations.allSatisfy(\.isRecommended) == true)
}
+ @Test func offersTheElectronDownloadsAnOlderToolKeptInTheHomeFolder() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file(".electron/electron-v3.1.13-darwin-x64.zip", bytes: 400_000)
+ try directory.file(".electron/SHASUMS256.txt-3.1.13", bytes: 4_096)
+ let electron = DeveloperCaches.definitions.filter { $0.id == "electron" }
+
+ let locations = await DeveloperCaches.scan(electron, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map(\.url.lastPathComponent) == [".electron"])
+ #expect(locations.allSatisfy { $0.kind == .downloads && $0.isRecommended })
+ }
+
@Test func offersWhatRustupDownloadedAndNeverItsToolchains() async throws {
let directory = try TemporaryDirectory()
try directory.file(".rustup/downloads/4b1c.partial", bytes: 400_000)