mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
The OG generation in the eleventy.before hook consumed too much memory alongside Eleventy's data cascade, causing the Eleventy process to be OOM-killed on Cloudron. Fix by running OG generation in a separate child process with its own 768MB heap limit. Also write the manifest incrementally (every 10 images) to preserve progress if interrupted.
20 lines
519 B
JavaScript
20 lines
519 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> <cacheDir> <siteName>
|
|
*/
|
|
|
|
import { generateOgImages } from "./og.js";
|
|
|
|
const [contentDir, cacheDir, siteName] = process.argv.slice(2);
|
|
|
|
if (!contentDir || !cacheDir || !siteName) {
|
|
console.error("[og] Usage: node og-cli.js <contentDir> <cacheDir> <siteName>");
|
|
process.exit(1);
|
|
}
|
|
|
|
await generateOgImages(contentDir, cacheDir, siteName);
|