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 Astro's and Expo's project folders among the build artifacts

Țugui Dragoșe72c9889065a
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index c213515b..21bd0baa 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -173,6 +173,8 @@ public enum ProjectArtifacts {
private static let nextConfigFiles = ["next.config.js", "next.config.mjs", "next.config.ts"]
private static let samProjectFiles = ["template.yaml", "template.yml", "samconfig.toml"]
private static let nuxtConfigFiles = ["nuxt.config.ts", "nuxt.config.js", "nuxt.config.mjs"]
+ private static let astroConfigFiles = ["mjs", "js", "cjs", "ts", "mts", "cts"].map { "astro.config." + $0 }
+ private static let expoConfigFiles = ["app.json", "app.config.js", "app.config.ts"]
private static let viteConfigFiles = ["ts", "mts", "cts", "js", "mjs", "cjs"].map { "vite.config." + $0 }
private static let vitestConfigFiles = ["ts", "mts", "cts", "js", "mjs", "cjs"].map { "vitest.config." + $0 }
private static let gatsbyConfigFiles = ["gatsby-config.js", "gatsby-config.ts", "gatsby-config.mjs"]
@@ -233,6 +235,16 @@ public enum ProjectArtifacts {
name: ".svelte-kit", markers: ["svelte.config.js"], tool: "SvelteKit", isGeneric: false,
source: "https://svelte.dev/docs/kit/project-structure"
),
+ // `.astro` also holds `settings.json`, the preferences set with `astro preferences`, kept nowhere else.
+ Definition(
+ name: ".astro", markers: astroConfigFiles, tool: "Astro", isGeneric: false,
+ source: "https://github.com/withastro/astro/blob/0a1036eef62f13c9609362874c5b88434d1e9300/packages/astro/src/preferences/README.md",
+ keepsItsSetup: true
+ ),
+ Definition(
+ name: ".expo", markers: expoConfigFiles, tool: "Expo", isGeneric: false,
+ source: "https://github.com/expo/expo/blob/119b336f677fc6ce44658ea34f79ba823028923d/packages/@expo/cli/src/start/project/dotExpo.ts#L56-L69"
+ ),
Definition(
name: ".angular", markers: ["angular.json"], tool: "Angular", isGeneric: false,
source: "https://angular.dev/cli/cache"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index 52f94cc8..5d52a19e 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -279,6 +279,7 @@ struct ProjectArtifactsTests {
Kind(artifact: ".nuxt", marker: "nuxt.config.ts", tool: "Nuxt", isGeneric: false),
Kind(artifact: ".output", marker: "nuxt.config.mjs", tool: "Nuxt", isGeneric: false),
Kind(artifact: ".svelte-kit", marker: "svelte.config.js", tool: "SvelteKit", isGeneric: false),
+ Kind(artifact: ".expo", marker: "app.json", tool: "Expo", isGeneric: false),
Kind(artifact: ".angular", marker: "angular.json", tool: "Angular", isGeneric: false),
Kind(artifact: ".turbo", marker: "turbo.json", tool: "Turborepo", isGeneric: false),
Kind(artifact: ".parcel-cache", marker: "package.json", tool: "Parcel", isGeneric: false),
@@ -345,6 +346,19 @@ struct ProjectArtifactsTests {
#expect(found.allSatisfy { $0.tool == "Meson" && $0.heldBack == .keepsItsSetup && !$0.isRecommended })
}
+ @Test func listsAstrosFolderAndKeepsItsPreferences() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("site/astro.config.mjs", bytes: 16)
+ try directory.file("site/.astro/settings.json", bytes: 16)
+ try directory.file("site/.astro/data-store.json", bytes: 400_000)
+ try age(directory.url, days: 60)
+
+ let found = await ProjectArtifacts.scan(roots: [directory.url]).artifacts
+
+ #expect(found.map(\.name) == [".astro"])
+ #expect(found.allSatisfy { $0.tool == "Astro" && $0.heldBack == .keepsItsSetup && !$0.isRecommended })
+ }
+
@Test func listsBloopsFolderAndKeepsItsWorkspaceSettings() async throws {
let directory = try TemporaryDirectory()
try directory.file("app/build.sbt", bytes: 16)