From 8a6d697308162874a236c84aac0b0f8c7ac01f83 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Tue, 1 Sep 2026 14:48:45 +0300 Subject: refactor: separate website presentation from runtime --- website/src/pages/index.astro | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 website/src/pages/index.astro (limited to 'website/src/pages/index.astro') diff --git a/website/src/pages/index.astro b/website/src/pages/index.astro deleted file mode 100644 index 26a048d4..00000000 --- a/website/src/pages/index.astro +++ /dev/null @@ -1,33 +0,0 @@ ---- -import { readFile } from 'node:fs/promises'; -import { agentCount, fmt, releaseVersion, siteStats } from '../site-data'; - -/* The numbers in the nav and hero strip are baked here at build time from the - snapshots and latest.json, so the page ships with real values, renders - correctly without JS, and can never be more than one deploy stale. A small - script on the page refreshes the counts live afterwards. */ -const homepage = await readFile(new URL('../../index.html', import.meta.url), 'utf8'); - -const { starCount, installCount, pluginCount } = await siteStats(); -const version = await releaseVersion(); -const facts = version ? `v${version} · Apache 2.0` : 'Apache 2.0'; - -/* the line drops out entirely rather than showing a placeholder if the - manifests can't be read — a missing sentence beats a wrong number */ -const agents = await agentCount(); -const agentsNote = agents ? `${agents} agents detected out of the box` : ''; -/* the strip carried a hardcoded 19; same source as row 04 now */ -const agentsCount = agents ? String(agents) : '—'; - -/* replaceAll, not replace: the star count appears in the nav as well as the - strip, and replace() would fill only the first of them. */ -const page = homepage - .replaceAll('', fmt(starCount)) - .replaceAll('', fmt(installCount)) - .replaceAll('', fmt(pluginCount)) - .replaceAll('', facts) - .replaceAll('', agentsNote) - .replaceAll('', agentsCount); ---- - - -- cgit v1.2.3