From 6c83bd98c94c82883bdd1eeaa2dfc6f0d3c40f71 Mon Sep 17 00:00:00 2001 From: mrbobbytables Date: Thu, 17 Sep 2026 21:42:27 +0000 Subject: [PATCH] fix(scripts): record post-conversion asset paths in import-architectures sanitizeArchitectureAssets() renames raster-embedded SVGs to PNG and deletes the original .svg file, but record.assets was built before that conversion ran, so the catalog kept pointing at the deleted .svg path. This made npm run validate:architectures fail with 'missing asset ...svg' on every daily import once rsvg-convert was available (fixed in #182). Build record.assets from the files that actually land in the destination directory after conversion, instead of from the source images directory before conversion. Fixes #121 Signed-off-by: mrbobbytables --- scripts/import-architectures.mjs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/import-architectures.mjs b/scripts/import-architectures.mjs index 12c02a63..1d522213 100644 --- a/scripts/import-architectures.mjs +++ b/scripts/import-architectures.mjs @@ -92,17 +92,24 @@ async function importArchitecture(id, commit) { }; const imageDir = join(dir, 'images'); + const destDir = join(assetsDir, id); if (existsSync(imageDir)) { for (const file of walkFiles(imageDir)) { - const destination = join(assetsDir, id, relative(imageDir, file)); + const destination = join(destDir, relative(imageDir, file)); mkdirSync(join(destination, '..'), { recursive: true }); cpSync(file, destination); + } + } + sanitizeArchitectureAssets(destDir); + // Build the asset list from what actually landed on disk, since + // sanitizeArchitectureAssets may rename raster-embedded SVGs to PNGs. + if (existsSync(destDir)) { + for (const file of walkFiles(destDir)) { record.assets.push( - `/img/architectures/${id}/${relative(imageDir, file).replaceAll('\\', '/')}`, + `/img/architectures/${id}/${relative(destDir, file).replaceAll('\\', '/')}`, ); } } - sanitizeArchitectureAssets(join(assetsDir, id)); await mirrorProjectAssets(body); const cleanBody = cleanMarkdown(renderProjectCards(body, id), id); record.summary = firstParagraph(cleanBody);