hex/site/scripts/prerender.ts
Kit Langton 754666b06b
Windows Setup.exe, one site, and a download section that works (#166)
* feat(windows): a per-user Setup.exe installer for the managed layout

* feat(release): build, test, and publish Setup.exe installers and the GitHub download mirror

* fix(onboarding): name the tray on Windows and the background service on Linux; keep Apps & Features on the updated version

* feat(site): one site with a platform-aware download section; retire hex.kitlangton.com

* feat(site): prerender the page, add robots, sitemap, llms.txt, JSON-LD, and favicon.ico
2026-10-19 19:26:41 -07:00

16 lines
806 B
TypeScript

// Puts the server-rendered Mac page into dist/index.html, so the copy and the
// download button are in the HTML before JavaScript runs; main.tsx hydrates it.
// Also stamps the release version into the JSON-LD.
import { readFileSync, rmSync, writeFileSync } from "node:fs"
import { render } from "../dist-server/prerender.js"
import { MAC_VERSION } from "../src/release"
const path = new URL("../dist/index.html", import.meta.url)
const html = readFileSync(path, "utf8")
const marker = '<div id="root"></div>'
if (!html.includes(marker)) throw new Error(`dist/index.html has no ${marker}`)
writeFileSync(
path,
html.replace(marker, `<div id="root">${render()}</div>`).replaceAll("__HEX_VERSION__", MAC_VERSION),
)
rmSync(new URL("../dist-server", import.meta.url), { recursive: true, force: true })