web/website/scripts/build-dunemarks.mjs
2026-11-27 23:43:05 +00:00

15 lines
1.8 KiB
JavaScript

import {readFileSync,writeFileSync} from 'node:fs';
import {renderDunemarkCollection} from '../control-panel/public/cp-v2/dunemark-catalogue.mjs';
import {updatePortalNavigation} from './portal-navigation.mjs';
const web=new URL('../web/',import.meta.url);
const exchangeFile=new URL('exchange.html',web);
writeFileSync(exchangeFile,readFileSync(exchangeFile,'utf8').replace(/<section class="dunemark-art"[\s\S]*?<\/section>/g,''));
const manualFile=new URL('manual-data.json',web),chapters=JSON.parse(readFileSync(manualFile,'utf8'));
const currency=chapters.find(c=>c.id==='solaris-spice-sales-and-guild-travel');
if(!currency)throw Error('Currency chapter missing');
currency.body=currency.body.replace(/<section class="dunemark-art"[\s\S]*?<\/section>/g,'').replace(/<p data-dunemark-collection>[\s\S]*?<\/p>/g,'');
currency.body='<p data-dunemark-collection><a href="https://cp.dunerealms.com/#bank/dunemark-collection">View the Dunemark Collection at Imperial Postbank →</a></p>'+currency.body;
writeFileSync(manualFile,JSON.stringify(chapters)+'\n');
const html='<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>The Dunemark Collection · Imperial Postbank</title><link rel="stylesheet" href="styles.css"><link rel="stylesheet" href="dunemark-collection.css"></head><body><main class="dm-public"><header><p>FEDERAL IMPERIAL RESERVE</p><h1>The Dunemark Collection</h1><p><a href="https://cp.dunerealms.com/#bank/dunemark-collection">Open at Imperial Postbank →</a></p></header>'+'<!-- currency-artwork-start -->'+renderDunemarkCollection()+'<!-- currency-artwork-end -->'+'</main></body></html>';
writeFileSync(new URL('dunemark-collection.html',web),updatePortalNavigation(html));
console.log('Built Federal Imperial Reserve collection under Postbank; removed Exchange gallery.');