import {HOUSE_STYLE_CSS} from './house-style.mjs'; import {bankRatesPage} from './bank-rates-page.mjs'; import{withCanonicalMenu,MAIN_MENU}from'./main-menu.mjs'; import{recordPageUpdates,withMenuBadges}from'./menu-updates.mjs'; import{updatePortalNavigation}from'./portal-navigation.mjs'; // Package the authored web and worker sources without rewriting their content. import {readFileSync,writeFileSync,openSync,writeSync,closeSync,readdirSync,statSync,mkdirSync,existsSync,rmSync,cpSync} from 'node:fs';import path from 'node:path';import {fileURLToPath} from 'node:url'; const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..'),web=path.join(root,'web'),dist=path.join(root,'dist'); // Fail before packaging if a public menu destination or illustration is missing. for(const [label,href,icon] of MAIN_MENU){ const url=new URL(href); if(url.hostname==='www.dunerealms.com'){ const relative=url.pathname==='/'?'index.html':decodeURIComponent(url.pathname.slice(1)); if(!existsSync(path.join(web,relative)))throw Error('Broken public menu link: '+label+' -> '+relative); } if(!existsSync(path.join(web,'assets',icon)))throw Error('Missing menu artwork: '+label+' -> '+icon); } for(const [page,dependencies] of [['shop.html',['shop-landing.css','shop-embed.js']],['kits.html',['kits.css','kits.js']]]){ for(const file of dependencies)if(!existsSync(path.join(web,file)))throw Error('Missing '+page+' dependency: '+file); } recordPageUpdates({root}); const homepage=readFileSync(path.join(web,'index.html'),'utf8'); const legalNotice=homepage.match(/