diff --git a/packages/cli/src/commands/snapshot.ts b/packages/cli/src/commands/snapshot.ts index 116103e56..f88fcab76 100644 --- a/packages/cli/src/commands/snapshot.ts +++ b/packages/cli/src/commands/snapshot.ts @@ -1,5 +1,7 @@ +import { spawn } from "node:child_process"; import { defineCommand } from "citty"; -import { existsSync, readFileSync, mkdirSync } from "node:fs"; +import { existsSync, mkdtempSync, readFileSync, mkdirSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; import { resolve, join, dirname, relative, isAbsolute } from "node:path"; import { fileURLToPath } from "node:url"; import { resolveProject } from "../utils/project.js"; @@ -9,6 +11,54 @@ import type { Example } from "./_examples.js"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); +/** + * Extract a single frame from a video file at `timeSeconds` via FFmpeg. + * Used to work around Chrome-headless's inability to reliably seek + *