From 5fda388a82b7e4ad0bdb828ac5cb33c16396cb02 Mon Sep 17 00:00:00 2001 From: SandObserver <260779319+SandObserver@users.noreply.github.com> Date: Sat, 22 Aug 2026 21:01:23 -0400 Subject: [PATCH] Docs: read the landing page release badge from the app repository --- scripts/check-dist.mjs | 11 +++++++++++ src/lib/repo.ts | 14 ++++++++++++++ src/pages/index.astro | 8 +++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/scripts/check-dist.mjs b/scripts/check-dist.mjs index 1ca8f51..ee0625a 100644 --- a/scripts/check-dist.mjs +++ b/scripts/check-dist.mjs @@ -112,6 +112,17 @@ report( .map(([f, src]) => `${f} fell back: ${src} was not read. Set STACKYARD_REPO.`), ); +/* The landing page release badge is read from the application repository's + api/package.json at build time. Without that checkout it renders nothing, and + a footer missing its version passes every check above. */ +const landing = 'dist/index.html'; +report( + 'verbadge', + existsSync(landing) && !/class="verbadge" data-version="\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?"/.test(read(landing)) + ? [`${landing}: no release badge. api/package.json was not read. Set STACKYARD_REPO.`] + : [], +); + /* The placeholder domain must never ship. */ report('domain', html.filter((f) => read(f).includes('stackyard.example')).map((f) => relative(DIST, f))); diff --git a/src/lib/repo.ts b/src/lib/repo.ts index fb2ac64..01aee64 100644 --- a/src/lib/repo.ts +++ b/src/lib/repo.ts @@ -20,3 +20,17 @@ export function absolutiseLinks(markdown: string): string { const base = 'https://github.com/SandObserver/stackyard/blob/main/'; return markdown.replace(/\]\((?!https?:|#|\/)([^)]+)\)/g, `](${base}$1)`); } + +/* Returns null when the app repo is absent or its manifest is unreadable. + scripts/check-dist.mjs fails the build when the badge is missing, so a null + here cannot ship as a blank footer. */ +export function readAppVersion(): string | null { + const raw = readRepoFile('api/package.json'); + if (!raw) return null; + try { + const version = JSON.parse(raw)?.version; + return typeof version === 'string' && version ? version : null; + } catch { + return null; + } +} diff --git a/src/pages/index.astro b/src/pages/index.astro index e55a863..44b7a90 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,4 +1,8 @@ --- +import { readAppVersion } from '../lib/repo'; + +const version = readAppVersion(); + const title = 'Stackyard: a homelab dashboard you\'ll actually use'; const description = 'A calm, customizable dashboard for your services, designed to be useful without becoming another wall of data.'; @@ -317,7 +321,9 @@ const schema = {
-
releasev1.7.1
+ {version && ( +
releasev{version}
+ )}
Apache License 2.0 · © 2026 SandObserver