| author | |
| committer | |
| log | 50871eb5de641ffd41b1f9d0151668982d276393 |
| tree | 5c5b507d25be1eb1df2aa065c250eff316d13150 |
| parent | 4b71a2ae2ffbbb7b6936051552094b71364cefd4 |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>2 files changed, 25 insertions(+), 1 deletions(-)
package.json+1-1| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | "private": true, | 3 | "private": true, |
| 4 | "type": "module", | 4 | "type": "module", |
| 5 | "scripts": { | 5 | "scripts": { |
| 6 | "prepare": "effect-tsgo patch && vp config --no-agent", | 6 | "prepare": "node scripts/clean-tsgo-backups.mjs && effect-tsgo patch && vp config --no-agent", |
| 7 | "dev": "node scripts/dev-runner.ts dev", | 7 | "dev": "node scripts/dev-runner.ts dev", |
| 8 | "dev:share": "node scripts/dev-runner.ts dev --share", | 8 | "dev:share": "node scripts/dev-runner.ts dev --share", |
| 9 | "dev:server": "node scripts/dev-runner.ts dev:server", | 9 | "dev:server": "node scripts/dev-runner.ts dev:server", |
scripts/clean-tsgo-backups.mjs created+24| ... | @@ -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. | ||
| 12 | import * as NodeFS from "node:fs"; | ||
| 13 | |||
| 14 | const backups = NodeFS.globSync( | ||
| 15 | "node_modules/.pnpm/@typescript+native-preview-*/node_modules/@typescript/native-preview-*/lib/tsgo{,.exe}.original*", | ||
| 16 | ); | ||
| 17 | |||
| 18 | for (const backup of backups) { | ||
| 19 | NodeFS.rmSync(backup, { force: true }); | ||
| 20 | } | ||
| 21 | |||
| 22 | if (backups.length > 0) { | ||
| 23 | console.log(`Removed ${backups.length} stale tsgo backup(s)`); | ||
| 24 | } | ||