fix(cli): match both TRANSCRIPT and script variable names in templates

Three templates use `const TRANSCRIPT = [...]` while warm-grain uses
`const script = [...]`. The patchTranscript function now matches both.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vance Ingalls
2026-03-26 18:03:34 +00:00
committed by Vance Ingalls
co-authored by Claude Opus 4.6
parent 7660aac962
commit e8a184fa6e
+6 -3
View File
@@ -277,10 +277,13 @@ function patchTranscript(dir: string, transcriptPath: string): void {
for (const file of htmlFiles) {
let content = readFileSync(file, "utf-8");
// Match: const script = [ ... ]; (the hardcoded word array in captions)
const match = content.match(/const script = \[[\s\S]*?\];/);
// Match: const script = [...] or const TRANSCRIPT = [...] (hardcoded word arrays in captions)
const scriptMatch = content.match(/const script = \[[\s\S]*?\];/);
const transcriptMatch = content.match(/const TRANSCRIPT = \[[\s\S]*?\];/);
const match = scriptMatch ?? transcriptMatch;
if (match) {
content = content.replace(match[0], `const script = ${wordsJson};`);
const varName = scriptMatch ? "script" : "TRANSCRIPT";
content = content.replace(match[0], `const ${varName} = ${wordsJson};`);
writeFileSync(file, content, "utf-8");
}
}