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 AWS SAM builds in Build Artifacts, never its pipeline

Țugui Dragoș8b254487c652
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index 81805c82..b2e12c4e 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -138,6 +138,7 @@ public enum ProjectArtifacts {
private static let gradleFiles = ["build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"]
private static let pythonProjectFiles = ["pyproject.toml", "requirements.txt", "Pipfile", "setup.py"]
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 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 }
@@ -601,6 +602,24 @@ public enum ProjectArtifacts {
name: ".terragrunt-cache", markers: ["terragrunt.hcl"], tool: "Terragrunt", isGeneric: false,
source: "https://docs.terragrunt.com/features/units/terragrunt-cache/"
),
+ // `.aws-sam` also keeps the pipeline `sam pipeline bootstrap` set up (`pipeline/pipelineconfig.toml`), so only
+ // the parts `sam build` and `sam sync` make again are offered.
+ Definition(
+ name: ".aws-sam/build", markers: samProjectFiles, tool: "AWS SAM", isGeneric: false,
+ source: "https://github.com/aws/aws-sam-cli/blob/b73a020cc555abaf6c2cbd3b902b9c91558a3ad9/samcli/commands/_utils/constants.py#L8"
+ ),
+ Definition(
+ name: ".aws-sam/cache", markers: samProjectFiles, tool: "AWS SAM", isGeneric: false,
+ source: "https://github.com/aws/aws-sam-cli/blob/b73a020cc555abaf6c2cbd3b902b9c91558a3ad9/samcli/commands/_utils/constants.py#L10"
+ ),
+ Definition(
+ name: ".aws-sam/deps", markers: samProjectFiles, tool: "AWS SAM", isGeneric: false,
+ source: "https://github.com/aws/aws-sam-cli/blob/b73a020cc555abaf6c2cbd3b902b9c91558a3ad9/samcli/lib/build/build_graph.py#L32"
+ ),
+ Definition(
+ name: ".aws-sam/auto-dependency-layer", markers: samProjectFiles, tool: "AWS SAM", isGeneric: false,
+ source: "https://github.com/aws/aws-sam-cli/blob/b73a020cc555abaf6c2cbd3b902b9c91558a3ad9/samcli/commands/_utils/constants.py#L9"
+ ),
// After the game engines, whose projects carry a .NET project file too.
Definition(
name: "bin", markers: dotNetProjectFiles, tool: ".NET", isGeneric: true,
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index c4492e4f..297f7276 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -422,6 +422,24 @@ struct ProjectArtifactsTests {
#expect(found.allSatisfy { $0.isRecommended })
}
+ @Test func offersWhatAWSSAMBuildsAndNeverItsPipeline() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("api/template.yaml", bytes: 16)
+ for part in ["build/HelloWorld/app.py", "cache/abc/app.py", "deps/abc/requests/api.py",
+ "auto-dependency-layer/HelloWorld/app.py"] {
+ try directory.file("api/.aws-sam/\(part)", bytes: 400_000)
+ }
+ try directory.file("api/.aws-sam/pipeline/pipelineconfig.toml", bytes: 400_000)
+ try age(directory.url, days: 60)
+
+ let found = await ProjectArtifacts.scan(roots: [directory.url]).artifacts
+
+ #expect(Set(found.map(\.name)) == [
+ ".aws-sam/build", ".aws-sam/cache", ".aws-sam/deps", ".aws-sam/auto-dependency-layer",
+ ])
+ #expect(found.allSatisfy { $0.isRecommended && $0.tool == "AWS SAM" })
+ }
+
@Test func findsRailsCacheInsideItsTemporaryFolderAndOnlyThere() async throws {
let directory = try TemporaryDirectory()
try directory.file("shop/config/application.rb", bytes: 16)