import { mkdirSync, readFileSync, writeFileSync } from 'fs'; import { join } from 'path'; const BUILD_DIR = 'build'; const BASE_URL = 'https://omaib-musprot.hf.space'; const template = readFileSync(join(BUILD_DIR, 'index.html'), 'utf-8'); const routes = [ { path: '', title: 'MuSProt: Multistate Protein Structure Database', description: 'Explore multistate protein structures, pairwise comparisons, energy scores, and functional annotations.', }, { path: 'docs', title: 'MuSProt Documentation', description: 'MuSProt dataset format, SQLite schema, and usage examples.', }, ]; for (const route of routes) { const canonical = `${BASE_URL}/${route.path}`; const head = [ `${route.title}`, ``, ``, ``, ``, ``, ``, ].join('\n '); const html = template .replace(/[^<]*<\/title>/, '') .replace(/<meta\s+name="description"[^>]*\/?>/, '') .replace('</head>', ` ${head}\n </head>`); const outputDir = route.path ? join(BUILD_DIR, route.path) : BUILD_DIR; mkdirSync(outputDir, { recursive: true }); writeFileSync(join(outputDir, 'index.html'), html, 'utf-8'); }