mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-05 05:37:09 +00:00
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:
committed by
Vance Ingalls
co-authored by
Claude Opus 4.6
parent
7660aac962
commit
e8a184fa6e
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user