chore: strip the comments this branch added

Removes every comment introduced on this branch: website/ in full, pages.yml
in full, and only the blocks added to ci.yml and release.yml — their
pre-existing comments are untouched.

Two directives survive because they are load-bearing rather than prose: the
triple-slash vite/client reference, and nothing else.

Two comments were carrying behaviour that the code did not state, so the
code now states it. useCopy's rejection handler clears the copied flag
instead of sitting empty, and writeTheme returns whether the write actually
landed instead of swallowing the failure in a bare catch. isExternal drops
its regex for two startsWith calls, which reads the same and no longer
hides a `//` inside a literal.
This commit is contained in:
Michel de Graaf
2026-07-25 01:29:55 +02:00
parent ba92e75fd3
commit c2dd227cee
45 changed files with 20 additions and 518 deletions
-25
View File
@@ -1,23 +1,8 @@
/*
* Turns the SPA build into real static files.
*
* Without this, GitHub Pages has no file at /install and answers a direct
* link with its 404 page. Writing one HTML file per route means every URL
* returns 200 with its own title, description, and fully rendered body; the
* client then hydrates it into the same interactive app.
*
* Run after both `vite build` and `vite build --ssr`.
*/
import { mkdir, readFile, writeFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import { NOT_FOUND_META, ROUTES, type RouteMeta } from '../src/lib/routes.ts'
/*
* Held in a variable so TypeScript does not try to resolve it: the module is
* a build artefact, and `bun run typecheck` runs before `vite build --ssr`
* has produced it. The cast is the contract with src/entry-server.tsx.
*/
const SSR_ENTRY = '../dist-ssr/entry-server.js'
const { render } = (await import(SSR_ENTRY)) as {
render: (location: string) => string
@@ -30,20 +15,12 @@ const SITE_URL = 'https://re-invention.nl/soulseek-rs/'
const escapeAttr = (value: string): string =>
value.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;')
/** Replaces the content of one `<meta>` matched by attribute and value. */
const setMeta = (html: string, attr: string, name: string, value: string): string =>
html.replace(
new RegExp(`(<meta\\s+${attr}="${name}"\\s+content=")[\\s\\S]*?(")`),
`$1${escapeAttr(value)}$2`,
)
/**
* Swaps every per-page tag in the template for the route's own.
*
* All five are listed here together on purpose: og:title and og:url used to be
* left alone, so each prerendered page advertised the site title and the
* homepage URL to anything reading Open Graph.
*/
const applyMeta = (html: string, meta: RouteMeta): string => {
const canonical = meta.path === '/' ? SITE_URL : `${SITE_URL}${meta.path.slice(1)}/`
let out = html.replace(
@@ -84,8 +61,6 @@ for (const route of ROUTES) {
await writePage(template, route, outPath, route.path)
}
// GitHub Pages serves this whenever no file matches, which after the loop
// above is only ever a genuinely unknown path.
await writePage(template, NOT_FOUND_META, '404.html', '/__not_found__')
console.log(`done — ${String(ROUTES.length + 1)} pages`)