fix: make starred page client-side rendered to avoid OOM

5,137 starred repos in Nunjucks template + Pagefind indexing exceeded
the 2048MB Eleventy heap limit during build. Switched to Alpine.js
client-side rendering:

- _data/githubStarred.js: returns only buildDate (no API fetch)
- starred.njk: fetches /githubapi/api/starred/all via Alpine.js
- Added client-side text search (replaces separate Pagefind index)
- Removed pagefind-starred build step and --exclude-selectors flag

Confab-Link: http://localhost:8080/sessions/b130e9e5-4723-435d-8d5a-fc38113381c9
This commit is contained in:
Ricardo
2026-03-02 13:40:33 +01:00
parent 9d29f24d93
commit a39b20375d
3 changed files with 177 additions and 214 deletions

View File

@@ -36,9 +36,6 @@ export default function (eleventyConfig) {
// Ignore Pagefind output directory
eleventyConfig.ignores.add("pagefind");
eleventyConfig.ignores.add("pagefind/**");
eleventyConfig.ignores.add("pagefind-starred");
eleventyConfig.ignores.add("pagefind-starred/**");
// Ignore interactive assets (served via passthrough copy, not processed as templates)
eleventyConfig.ignores.add("interactive");
eleventyConfig.ignores.add("interactive/**");
@@ -50,8 +47,6 @@ export default function (eleventyConfig) {
eleventyConfig.watchIgnores.add("/app/data/site/**");
eleventyConfig.watchIgnores.add("pagefind");
eleventyConfig.watchIgnores.add("pagefind/**");
eleventyConfig.watchIgnores.add("pagefind-starred");
eleventyConfig.watchIgnores.add("pagefind-starred/**");
eleventyConfig.watchIgnores.add(".cache/og");
eleventyConfig.watchIgnores.add(".cache/og/**");
eleventyConfig.watchIgnores.add(".cache/unfurl");
@@ -1043,7 +1038,7 @@ export default function (eleventyConfig) {
const outputDir = directories?.output || dir.output;
try {
console.log(`[pagefind] Indexing ${outputDir} (${runMode})...`);
execFileSync("npx", ["pagefind", "--site", outputDir, "--output-subdir", "pagefind", "--glob", "**/*.html", "--exclude-selectors", ".starred-card"], {
execFileSync("npx", ["pagefind", "--site", outputDir, "--output-subdir", "pagefind", "--glob", "**/*.html"], {
stdio: "inherit",
timeout: 120000,
});
@@ -1052,22 +1047,6 @@ export default function (eleventyConfig) {
console.error("[pagefind] Indexing failed:", err.message);
}
// Starred repos Pagefind index — separate from main site search
try {
console.log("[pagefind-starred] Indexing starred repos...");
execFileSync("npx", [
"pagefind",
"--site", outputDir,
"--output-subdir", "pagefind-starred",
"--glob", "github/starred/index.html",
], {
stdio: "inherit",
timeout: 120000,
});
console.log("[pagefind-starred] Indexing complete");
} catch (err) {
console.error("[pagefind-starred] Indexing failed:", err.message);
}
}
// WebSub hub notification — skip on incremental rebuilds