Files
zeekay 0986ae0039
Deploy Base Docs / deploy (push) Failing after 7m34s
Deploy Zen Docs / deploy (push) Failing after 2m21s
Deploy ZT Docs / deploy (push) Failing after 5m45s
Deploy Dev Docs / deploy (push) Failing after 4m6s
Deploy Insights Docs / deploy (push) Failing after 4m40s
Deploy Bot Docs / deploy (push) Failing after 9m38s
Hanzo CI/CD / test (linux-arm64) (push) Skipped
Hanzo CI/CD / test (linux-amd64) (push) Skipped
Hanzo CI/CD / test-advisory (push) Skipped
Deploy Cloud Landing Page / deploy (push) Failing after 6m18s
Hanzo CI/CD / test-amd64 (push) Canceled after 0s
Hanzo CI/CD / verify (push) Canceled after 0s
CI/CD / cicd (push) Canceled after 2h48m32s
Hanzo CI/CD / cicd (push) Canceled after 0s
Release / Release (push) Failing after 2m11s
bot-docs: it builds, and serves its icon from public
The build failed on every run: @hanzo/ui/next adds an SVG loader, @svgr/webpack, that
the app did not depend on. The app depends on it now. The icon is public/favicon.svg,
which the layout's metadata names; an icon file in app/ goes through Next's image
pipeline and failed the export.

Testing: pnpm build --filter=bot-docs exits 0 and writes out/favicon.svg, the icon link
and no whatsapp-bot.jpg; scripts/assets.test.ts holds the pictures and the icon.
Risk: low. The deploy has never succeeded.
How to revert: revert this commit.

Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
2026-11-20 22:50:13 -08:00

37 lines
1.5 KiB
TypeScript

import { existsSync, readdirSync, readFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
const ROOT = resolve(import.meta.dirname, '..');
const PUBLIC = join(ROOT, 'public');
const CONTENT = join(ROOT, 'content/docs');
const pages = (dir: string): string[] =>
readdirSync(dir, { withFileTypes: true }).flatMap((e) =>
e.isDirectory() ? pages(join(dir, e.name)) : /\.mdx?$/.test(e.name) ? [join(dir, e.name)] : [],
);
// A page that names an image the site does not carry is a 404 on every visit and a
// broken picture where the page put it. The app is a static export, so the files a
// page can name are `public/`'s, at the root: a relative name is read from the root
// of the host, as the browser reads `whatsapp-bot.jpg` on /docs.
describe('the images a docs page names', () => {
it('are files the export carries', () => {
const missing: string[] = [];
for (const page of pages(CONTENT)) {
const text = readFileSync(page, 'utf8');
for (const [, src] of text.matchAll(/<img\b[^>]*\bsrc=["']([^"']+)["']/g)) {
if (/^(?:[a-z]+:|\/\/|data:)/i.test(src)) continue;
if (!existsSync(join(PUBLIC, src.replace(/^\//, '').split(/[?#]/)[0]!))) {
missing.push(`${page.slice(CONTENT.length + 1)}: ${src}`);
}
}
}
expect(missing).toEqual([]);
});
it('has the icon the layout names', () => {
expect(existsSync(join(PUBLIC, 'favicon.svg'))).toBe(true);
});
});