Files
KArtSell.Aegis/docs/Design/kbx-foundation-v36/scripts/generate-navigation-manifest.mjs
T

6 lines
586 B
JavaScript

import fs from 'node:fs'
import path from 'node:path'
const root=process.cwd();const source=path.join(root,'apps/web/src/shell/navigationCatalog.ts');const out=path.join(root,'generated/navigation-manifest.json');const text=fs.readFileSync(source,'utf8')
const items=[...text.matchAll(/\{\s*screenId:'([^']+)',\s*path:'([^']+)',\s*section:'([^']+)'[\s\S]*?order:(\d+)/g)].map(m=>({screenId:m[1],path:m[2],section:m[3],order:Number(m[4])}))
fs.writeFileSync(out,JSON.stringify(items,null,2)+'\n');console.log(`generated ${items.length} navigation entries -> ${path.relative(root,out)}`)