History

fix: marketing site Vercel builds no longer die after ~100 deploys (#4975)

Theo Browne committed 3 months agov0.0.32-nightly.20260730.956

Commit 50871eb1 parent 4b71a2a2 files · +25 −1Browse files

Showing the changes to scripts (1 of 2 files). Show all

Unified · Split

scripts/clean-tsgo-backups.mjs+24−0
@@ -0,0 +1,24 @@
1// Deletes stale tsgo backup files left behind by `effect-tsgo patch`.
2//
3// The patch command backs up the real tsgo binary to `tsgo.original`, and if
4// that name is taken it writes `tsgo.original.1`, `.2`, ... without ever
5// cleaning up. On runners that restore node_modules from a build cache
6// (Vercel), backups accumulate across deploys until patch hard-fails at 101
7// with "Too many backup files exist". Removing them is safe: from the second
8// patch onward the backup is just the previously-patched binary, and pnpm
9// restores the pristine one whenever the package is re-materialized.
10//
11// Runs as part of `prepare`, so it must only use node builtins.
12import * as NodeFS from "node:fs";
13
14const backups = NodeFS.globSync(
15 "node_modules/.pnpm/@typescript+native-preview-*/node_modules/@typescript/native-preview-*/lib/tsgo{,.exe}.original*",
16);
17
18for (const backup of backups) {
19 NodeFS.rmSync(backup, { force: true });
20}
21
22if (backups.length > 0) {
23 console.log(`Removed ${backups.length} stale tsgo backup(s)`);
24}