build(sdlc): seed data, figures and rendered package for 23/09 feedback

This commit is contained in:
Thanakorn
2026-09-24 09:19:05 +07:00
parent 6c1d66d8de
commit be020e332b
146 changed files with 788 additions and 313 deletions
+11 -1
View File
@@ -11,6 +11,7 @@ import * as other from './docs-other.mjs';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
const target = path.join(root, 'sdlc');
const figureSource = path.join(path.dirname(fileURLToPath(import.meta.url)), 'figures');
// Folders that must exist even when a work product is evidence rather than a document.
const FOLDERS = [
@@ -71,7 +72,16 @@ async function main() {
await fs.rm(target, { recursive: true, force: true });
for (const folder of FOLDERS) await fs.mkdir(path.join(target, folder), { recursive: true });
for (const d of docs) await fs.writeFile(path.join(target, d.dir, `${d.name}.md`), d.md, 'utf8');
for (const d of docs) {
await fs.writeFile(path.join(target, d.dir, `${d.name}.md`), d.md, 'utf8');
// Figures referenced as ![caption](figures/x.png) are copied next to the document.
for (const [, file] of d.md.matchAll(/^!\[[^\]]*\]\(figures\/([^)]+)\)$/gm)) {
const from = path.join(figureSource, file);
try { await fs.access(from); } catch { throw new Error(`${d.name} references missing figure ${file}; run scripts/sdlc-delivery/render-figures.mjs`); }
await fs.mkdir(path.join(target, d.dir, 'figures'), { recursive: true });
await fs.copyFile(from, path.join(target, d.dir, 'figures', file));
}
}
const empty = [];
for (const folder of FOLDERS) {