diff --git a/scripts/check-protected-deletions.mjs b/scripts/check-protected-deletions.mjs index 339578dce..5a7fa05ce 100644 --- a/scripts/check-protected-deletions.mjs +++ b/scripts/check-protected-deletions.mjs @@ -1,8 +1,16 @@ #!/usr/bin/env node import { execFileSync } from "node:child_process"; +import { existsSync } from "node:fs"; const PROTECTED_PATHS = [":(glob)src/resources/extensions/**/*.d.ts"]; +if (!existsSync(".git")) { + process.stdout.write( + "check-protected-deletions: skipped outside git worktree\n", + ); + process.exit(0); +} + function git(args) { return execFileSync("git", args, { stdio: ["ignore", "pipe", "pipe"],