All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m51s
The cache was written to .cache/og/ relative to the workspace, which is under /usr/local/git/.cache/act/<unique-hash>/hostexecutor/ — a new path per run, so every build regenerated all images from scratch. OG_CACHE_DIR env var now controls the cache path (resolved to an absolute path). CI sets it to /usr/local/git/.cache/og, which survives between runs. Locally it still defaults to .cache/og inside the project dir. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
1016 B
JavaScript
31 lines
1016 B
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* CLI entry point for OG image generation.
|
|
* Runs as a separate process to isolate memory from Eleventy.
|
|
*
|
|
* Usage: node lib/og-cli.js <contentDir> <ogDir> <siteName> [batchSize]
|
|
*
|
|
* batchSize: Max images to generate per invocation (0 = unlimited).
|
|
* When set, exits after generating that many images so the caller
|
|
* can re-spawn (releasing all WASM native memory between batches).
|
|
* Exit code 2 = batch complete, more work remains.
|
|
*/
|
|
|
|
import { generateOgImages } from "./og.js";
|
|
|
|
const [contentDir, ogDir, siteName, batchSizeStr] = process.argv.slice(2);
|
|
|
|
if (!contentDir || !ogDir || !siteName) {
|
|
console.error("[og] Usage: node og-cli.js <contentDir> <ogDir> <siteName> [batchSize]");
|
|
process.exit(1);
|
|
}
|
|
|
|
const batchSize = parseInt(batchSizeStr, 10) || 0;
|
|
const result = await generateOgImages(contentDir, ogDir, siteName, batchSize);
|
|
|
|
// Exit code 2 signals "batch complete, more images remain"
|
|
if (result?.hasMore) {
|
|
process.exit(2);
|
|
}
|