Skip to content

Commit 4767e5b

Browse files
migration: cleanup old gen files
1 parent f4220e6 commit 4767e5b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/generate-prompts.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* .ts files with exported string constants that bundle correctly.
1010
*/
1111

12-
import { readFileSync, writeFileSync, readdirSync, mkdirSync } from "node:fs"
12+
import { readFileSync, writeFileSync, readdirSync, mkdirSync, unlinkSync } from "node:fs"
1313
import { dirname, join, basename } from "node:path"
1414
import { fileURLToPath } from "node:url"
1515

@@ -20,6 +20,13 @@ const CODEGEN_DIR = join(PROMPTS_DIR, "_codegen")
2020
// Ensure _codegen directory exists
2121
mkdirSync(CODEGEN_DIR, { recursive: true })
2222

23+
// MIGRATION - Clean up old generated files from the prompts directory root (they're now in _codegen/)
24+
const oldGeneratedFiles = readdirSync(PROMPTS_DIR).filter((f) => f.endsWith(".generated.ts"))
25+
for (const file of oldGeneratedFiles) {
26+
unlinkSync(join(PROMPTS_DIR, file))
27+
console.log(`Cleaned up old: ${file}`)
28+
}
29+
2330
// Find all .md files in the prompts directory
2431
const mdFiles = readdirSync(PROMPTS_DIR).filter((f) => f.endsWith(".md"))
2532

0 commit comments

Comments
 (0)