Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/check-dist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));

Expand Down
14 changes: 14 additions & 0 deletions src/lib/repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
8 changes: 7 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -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.';
Expand Down Expand Up @@ -317,7 +321,9 @@ const schema = {
</div>
</div>
<div class="foot-r">
<div class="verbadge"><span>release</span><b>v1.7.1</b></div>
{version && (
<div class="verbadge" data-version={version}><span>release</span><b>v{version}</b></div>
)}
<div class="license">Apache License 2.0 · © 2026 SandObserver</div>
</div>
</div>
Expand Down