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 what Quarto keeps and builds in a project in Build Artifacts

Țugui Dragoș2670797ea28f
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index b109fe92..46bd393b 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -154,6 +154,7 @@ public enum ProjectArtifacts {
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 jekyllConfigFiles = ["_config.yml", "_config.yaml", "_config.toml"]
+ private static let quartoProjectFiles = ["_quarto.yml", "_quarto.yaml"]
private static let eleventyConfigFiles = [".eleventy.js"] + ["buildawesome.config", "eleventy.config"].flatMap { name in
["js", "mjs", "cjs", "ts", "mts", "cts"].map { "\(name).\($0)" }
}
@@ -346,6 +347,20 @@ public enum ProjectArtifacts {
name: ".jekyll-cache", markers: jekyllConfigFiles, tool: "Jekyll", isGeneric: false,
source: "https://github.com/jekyll/jekyll/blob/541d8b2ee75c8907de4744d4b87a7a6f1f997cae/lib/jekyll/commands/clean.rb#L20-L31"
),
+ // `.quarto` keeps only what Quarto makes again; the results a project chose to freeze are in `_freeze`, which
+ // Quarto has the person keep in version control, so it is never listed.
+ Definition(
+ name: ".quarto", markers: quartoProjectFiles, tool: "Quarto", isGeneric: false,
+ source: "https://github.com/quarto-dev/quarto-cli/blob/a57cc76458d91a0577c162a474929119e6b663ba/src/project/project-scratch.ts#L12-L24"
+ ),
+ Definition(
+ name: "_site", markers: quartoProjectFiles, tool: "Quarto", isGeneric: true,
+ source: "https://github.com/quarto-dev/quarto-cli/blob/a57cc76458d91a0577c162a474929119e6b663ba/src/project/types/website/website.ts#L112"
+ ),
+ Definition(
+ name: "_book", markers: quartoProjectFiles, tool: "Quarto", isGeneric: true,
+ source: "https://github.com/quarto-dev/quarto-cli/blob/a57cc76458d91a0577c162a474929119e6b663ba/src/project/types/book/book.ts#L115"
+ ),
Definition(
name: ".dart_tool", markers: ["pubspec.yaml"], tool: "Dart & Flutter", isGeneric: false,
source: "https://dart.dev/tools/pub/package-layout"
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index aeac04c5..45cd81f8 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -375,9 +375,24 @@ struct ProjectArtifactsTests {
Kind(artifact: ".terragrunt-cache", marker: "terragrunt.hcl", tool: "Terragrunt", isGeneric: false),
Kind(artifact: "_site", marker: "_config.yml", tool: "Jekyll", isGeneric: true),
Kind(artifact: ".jekyll-cache", marker: "_config.toml", tool: "Jekyll", isGeneric: false),
+ Kind(artifact: ".quarto", marker: "_quarto.yml", tool: "Quarto", isGeneric: false),
+ Kind(artifact: "_site", marker: "_quarto.yaml", tool: "Quarto", isGeneric: true),
+ Kind(artifact: "_book", marker: "_quarto.yml", tool: "Quarto", isGeneric: true),
])
}
+ @Test func neverListsTheResultsAQuartoProjectFroze() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("paper/_quarto.yml", bytes: 16)
+ try directory.file("paper/_freeze/analysis/execute-results/html.json", bytes: 400_000)
+ try directory.file("paper/.quarto/_freeze/analysis/execute-results/html.json", bytes: 400_000)
+ try age(directory.url, days: 60)
+
+ let found = await ProjectArtifacts.scan(roots: [directory.url]).artifacts
+
+ #expect(found.map(\.name) == [".quarto"])
+ }
+
@Test func findsAidersTagsCacheOnlyWithItsDatabase() async throws {
let directory = try TemporaryDirectory()
try directory.file("tool/main.py", bytes: 16)