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.

Offer what docusaurus clear removes in Build Artifacts

Țugui Dragoșed1a8ec23a7f
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index 3dd51ba2..cecf370b 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -145,6 +145,7 @@ public enum ProjectArtifacts {
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"]
+ private static let docusaurusConfigFiles = ["ts", "mts", "cts", "js", "mjs", "cjs"].map { "docusaurus.config." + $0 }
private static let unityProjectFile = "ProjectSettings/ProjectVersion.txt"
private static let dotNetProjectFiles = ["*.csproj", "*.fsproj", "*.vbproj", "*.sln"]
private static let pytestFiles = [
@@ -199,6 +200,14 @@ public enum ProjectArtifacts {
name: ".turbo", markers: ["turbo.json"], tool: "Turborepo", isGeneric: false,
source: "https://turborepo.dev/docs/crafting-your-repository/caching"
),
+ Definition(
+ name: ".docusaurus", markers: docusaurusConfigFiles, tool: "Docusaurus", isGeneric: false,
+ source: "https://github.com/facebook/docusaurus/blob/c245217563f6491fdb79bf5ac91bfa16536e5de9/packages/docusaurus/src/commands/clear.ts#L33-L52"
+ ),
+ Definition(
+ name: "build", markers: docusaurusConfigFiles, tool: "Docusaurus", isGeneric: true,
+ source: "https://github.com/facebook/docusaurus/blob/c245217563f6491fdb79bf5ac91bfa16536e5de9/packages/docusaurus/src/commands/clear.ts#L33-L52"
+ ),
// Only what `nx reset` removes, the cache and the database together: before Nx's #37111 a database row whose
// files were gone was a hit that restored nothing. `.nx` can also hold the release plans a team commits.
Definition(
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index 43b1cf59..1cd225f4 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -416,6 +416,20 @@ struct ProjectArtifactsTests {
#expect(found.first?.isRecommended == true)
}
+ @Test func offersWhatDocusaurusClearRemoves() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("site/docusaurus.config.mjs", bytes: 16)
+ try directory.file("site/.docusaurus/client-modules.js", bytes: 400_000)
+ try directory.file("site/build/index.html", bytes: 400_000)
+ try age(directory.url, days: 60)
+
+ let found = await ProjectArtifacts.scan(roots: [directory.url]).artifacts
+
+ #expect(found.map(\.name).sorted() == [".docusaurus", "build"])
+ #expect(found.allSatisfy { $0.tool == "Docusaurus" })
+ #expect(found.filter(\.isRecommended).map(\.name) == [".docusaurus"])
+ }
+
@Test func offersNxsFolderOnlyWhenItHoldsWhatNxResetRemoves() async throws {
let directory = try TemporaryDirectory()
for project in ["reset", "plans", "cacheOnly"] {