Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
c23875f
docs(dox): owner steps for Search Console, Bing and crawler reports (…
craig-o-curtis Nov 7, 2026
79f3a1f
feat(dox): accurate page dates, noindex on twins and long-lived asset…
craig-o-curtis Nov 7, 2026
883c1b5
feat(dox): llms.txt that fits in context, one file per namespace (DOX…
craig-o-curtis Nov 8, 2026
8ec92e8
feat(dox): lean sidebar, own namespace in full and an Overview link f…
craig-o-curtis Nov 8, 2026
f20d3f3
Merge remote-tracking branch 'origin/main' into 448-dox-g6-research-a…
craig-o-curtis Nov 8, 2026
d50ab39
feat(dox): no two pages share a meta description (DOX-G6, #448)
craig-o-curtis Nov 8, 2026
ba8715b
feat(dox): share cards that survive a square crop, with share tags th…
craig-o-curtis Nov 8, 2026
80cae2c
feat(dox): one changelog page per release line, so no page nears 1 MB…
craig-o-curtis Nov 8, 2026
29688e4
perf(dox): hero clock off the first-paint path, one layout pass for t…
craig-o-curtis Nov 8, 2026
e602415
feat(dox): globe drawn off the main thread, started when idle, paused…
craig-o-curtis Nov 8, 2026
84814ed
docs(dox): DOX-G6 close-out: globe rules, tracker Done, CORE-86 searc…
craig-o-curtis Nov 8, 2026
96f25ad
Merge remote-tracking branch 'origin/main' into 448-dox-g6-research-a…
craig-o-curtis Nov 8, 2026
922a03d
fix(ci): the local dox-dist check runs share-preview and select-optio…
craig-o-curtis Nov 8, 2026
9a3fee6
style(dox): globe canvas declarations in stylelint order (DOX-G6, #44…
craig-o-curtis Nov 8, 2026
d516fc3
fix(dox): every built-site test runs in CI, a late globe renderer is …
craig-o-curtis Nov 8, 2026
0f41506
fix(dox): the late-renderer globe test asserts on the renderers, not …
craig-o-curtis Nov 8, 2026
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
Binary file removed .github/social-preview.png
Binary file not shown.
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,16 @@ jobs:
# DOX_DIST_REQUIRED turns those gates' "no dist, nothing to check" skip into a failure, but
# only here, where the step above guarantees a build. Keyed to `CI` it would fire in the
# Tests job too, which runs the same suite on three Node versions and does not build the site.
# `dist-base.test.ts` reads the same build for the /gmt base: a root URL without `/gmt` in any
# HTML, CSS, script, `.md`, `llms*.txt`, sitemap or `_redirects` fails here.
# `head-tags.test.ts` checks each built page's title, description and share tags.
# `select-options.test.ts` checks no built select repeats an option value or label.
# `gates/registry.test.ts` checks the gates' sample pages exist in it, and `a11y-tab-walk`'s
# page contract, which lists a subset of the built pages.
- name: "Built site: text surfaces, the /gmt base, head tags, select options and the gate pages"
# `test:dist` (apps/dox/scripts/dist-tests.mjs) runs every Node test that imports
# `scripts/dist-dir.ts`, found by that rule rather than from a list, so a new built-site test
# cannot be left out: a hand-kept list here once missed five of them. Among them, the /gmt
# base, each page's head tags and share cards, the sidebar's reach, select options and the
# gates' sample pages.
- name: "Built site: every test that reads apps/dox/dist"
if: contains(fromJSON(env.CHECKS), 'dox-dist')
env:
DOX_DIST_REQUIRED: "1"
run: pnpm --filter dox exec vitest run scripts/llms.test.ts scripts/dist-base.test.ts scripts/head-tags.test.ts scripts/select-options.test.ts scripts/gates/registry.test.ts
run: pnpm --filter dox run test:dist

# No table on a built page scrolls sideways at 1440 px. The check opens every built page with a
# table in Chromium, so it needs the browser the Dox gates job installs.
Expand Down
21 changes: 21 additions & 0 deletions apps/dox/assets/share/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Share images

Upload-ready images for the places that take a picture by hand.

| File | Size | Use |
| --------------------------- | ---------- | ----------------------------------------------------------------------------- |
| `github-social-preview.png` | 1280 x 640 | The repository's social preview (Settings, Social preview). |
| `og-default-1200x630.png` | 1200 x 630 | The site card: the same image as `/og/site.png`. For profiles and listings. |
| `earth-1200x630.png` | 1200 x 630 | The artwork alone, with no text: sky, Earth and the cyan edge. |

The Earth is centred on the midpoint of Helsinki and Isafjordur, and painted in the site's colours.

Regenerate all three, with the same bytes each time:

```sh
pnpm --filter dox run social-preview
```

This folder is outside `src/` and `public/`, so the site build does not publish it.

Imagery: NASA Earth Observatory, Blue Marble Next Generation (public domain).
Binary file added apps/dox/assets/share/earth-1200x630.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/dox/assets/share/github-social-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/dox/assets/share/og-default-1200x630.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions apps/dox/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import rehypeBaseLinks from "./src/lib/rehype-base-links.ts";
import rehypeExternalLinks from "./src/lib/rehype-external-links.ts";
import rehypeTableScroll from "./src/lib/rehype-table-scroll.ts";
import { copyRedirects } from "./src/lib/copy-redirects.ts";
import { sitemapLastmod } from "./src/lib/sitemap-lastmod.ts";
import { versionOgImages } from "./src/lib/og-image-version.ts";
import { pruneWidgetCss } from "./src/lib/prune-widget-css.ts";
import { gmtReferenceWatch } from "./src/lib/gmt-reference-watch.ts";
import { devWorkerProxy } from "./src/lib/dev-worker-proxy.ts";
Expand All @@ -28,6 +30,9 @@ import { MIGRATE, START_HERE } from "./src/lib/section-order.ts";
// and Pagefind resolve under /gmt/. One module holds both, for the Worker and
// the scripts too.

/* Where the build writes the pages (`outDir` below), for the sitemap to read. */
const OUT_DIR = fileURLToPath(new URL("./dist/gmt", import.meta.url));

const gmtPkg = fileURLToPath(
new URL("../../packages/gmt/dist", import.meta.url),
);
Expand Down Expand Up @@ -139,6 +144,9 @@ export default defineConfig({
copyRedirects(),
// Build only: drops a widget's stylesheet link from the pages that do not show the widget.
pruneWidgetCss(),
// Build only: puts ?v=<hash of the PNG> on og:image and twitter:image. It stays above starlight(),
// whose Pagefind step runs on the same hook, so Pagefind and the dist gates read the final HTML.
versionOgImages(),
react(),
starlight({
title: "@northguild/gmt",
Expand Down Expand Up @@ -204,15 +212,6 @@ export default defineConfig({
blocking: "render",
},
},
// DOX-A3b: discoverability — let LLMs find the llms.txt surface
{
tag: "link",
attrs: {
rel: "alternate",
type: "text/plain",
href: withBase("/llms.txt"),
},
},
/* Raster fallbacks for the SVG favicon above, generated from it by
`pnpm run favicons`. Starlight sorts its own `rel="shortcut icon"`
entry *after* extra icon links precisely so the SVG wins wherever
Expand Down Expand Up @@ -299,9 +298,11 @@ export default defineConfig({
],
}),
// After starlight(): Starlight adds its own sitemap only when none is configured. /dox/ is
// the chat shell and has `noindex`, so it is not listed.
// the chat shell and has `noindex`, so it is not listed. `lastmod` is the date in the page's
// footer, read from the built HTML (`src/lib/sitemap-lastmod.ts`).
sitemap({
filter: (page) => new URL(page).pathname !== withBase("/dox/"),
serialize: (item) => sitemapLastmod(OUT_DIR, item),
}),
],
});
3 changes: 2 additions & 1 deletion apps/dox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"check": "pnpm run generate && astro sync && astro check",
"typecheck": "pnpm run check",
"test": "pnpm run generate && vitest run",
"test:dist": "node scripts/dist-tests.mjs",
"lint": "oxlint && stylelint \"src/**/*.{css,astro}\"",
"reference:export": "tsx ./scripts/export-reference.ts",
"docs-check": "tsx ./scripts/check-reference-docs.ts",
Expand Down Expand Up @@ -56,7 +57,6 @@
"@tanstack/virtual-core": "^3.17.8",
"ai": "^7.0.95",
"astro": "7.4.2",
"astro-og-canvas": "0.13.2",
"canvaskit-wasm": "^0.42.0",
"class-variance-authority": "^0.7.1",
"clsx": "2.1.1",
Expand All @@ -74,6 +74,7 @@
"radix-ui": "^1.6.7",
"react": "19.3.0",
"react-dom": "19.3.0",
"sharp": "0.35.5",
"shiki": "^4.4.3",
"streamdown": "^2.6.0",
"tailwind-merge": "3.6.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/dox/scripts/a11y-tab-walk.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*
* At 390 the mobile menu is opened only when the walk reaches its toggle; the menu's links count as
* candidates only once it is open. `/dox/` is walked as it opens and once more with a widget in the
* rail. The pages are every page outside `/reference/`, plus the first function page and the first
* type page: reference pages share one template and each carries the full sidebar.
* rail. The pages are every page outside `/reference/`, plus the first function page of each
* namespace and the first type page: a reference page carries only its own namespace's tree.
*
* Usage (a built site served, as `pnpm --filter dox gates --only a11y-tab-walk` does):
* node scripts/a11y-tab-walk.mjs [--base http://127.0.0.1:48291/gmt] [--browsers chromium,webkit]
Expand Down
106 changes: 84 additions & 22 deletions apps/dox/scripts/build-changelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
/**
* Generate the changelog pages from each package's CHANGELOG.md and the release tags.
*
* Emits one page per package that has a CHANGELOG.md: src/content/docs/changelog/index.md for
* `@northguild/gmt` and changelog/<dir>.md for each other package. The package list is read from
* the directory, so a new package with a changelog gets a page with no change here (the sidebar
* test then names the missing link). A version's scope (current or
* Emits, per package that has a CHANGELOG.md, an index page and one page per release line
* (`major.minor`): src/content/docs/changelog/index.md and changelog/<line>.md for
* `@northguild/gmt`, changelog/<dir>/index.md and changelog/<dir>/<line>.md for each other
* package. A line's page holds its release notes, so no page nears the 1 MB a Messages preview
* reads; the index lists the lines and repeats no note. The package list is read from the
* directory, so a new package with a changelog gets its pages with no change here (the sidebar
* test then names the missing link). Any .md in the output directory that a run did not write is
* deleted. A version's scope (current or
* the retired `@burglekitt`) and its release date come from its git tag, read in one call; the
* transform is in lib/changelog.mjs. This script never writes the CHANGELOG.md files; they are
* the release record. The emitted page is gitignored.
Expand All @@ -25,18 +29,22 @@ import {
mkdirSync,
readdirSync,
readFileSync,
rmSync,
writeFileSync,
} from "node:fs";
import { execFileSync } from "node:child_process";
import { dirname, resolve } from "node:path";
import { dirname, relative, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { loadGmt } from "../../../scripts/lib/gmt.mjs";
import {
describePage,
groupReleases,
lineSlug,
parseChangelog,
parseTags,
renderPage,
releaseLines,
renderIndexPage,
renderLinePage,
} from "./lib/changelog.mjs";

const __dirname = dirname(fileURLToPath(import.meta.url));
Expand All @@ -50,7 +58,12 @@ const PACKAGES = readdirSync(resolve(repoRoot, "packages"))
existsSync(resolve(repoRoot, "packages", dir, "CHANGELOG.md")),
)
.sort((a, b) => (a === "gmt" ? -1 : b === "gmt" ? 1 : a.localeCompare(b)))
.map((dir) => ({ dir, out: dir === "gmt" ? "index.md" : `${dir}.md` }));
.map((dir) => ({
dir,
// The directory under changelog/ and the route of the package's index page.
folder: dir === "gmt" ? "" : dir,
route: dir === "gmt" ? "/changelog/" : `/changelog/${dir}/`,
}));

/** Where a retired-scope plate sends the reader to install: the library, or a plugin's guide. */
const installLinkFor = (dir) =>
Expand Down Expand Up @@ -79,7 +92,24 @@ try {
);

mkdirSync(outDir, { recursive: true });
for (const { dir, out } of PACKAGES) {
/** Absolute paths of every page this run keeps. */
const kept = new Set();
/** Idempotent write: don't bump mtime when nothing changed. Returns whether it wrote. */
const write = (path, source) => {
kept.add(path);
mkdirSync(dirname(path), { recursive: true });
let previous = "";
try {
previous = readFileSync(path, "utf8");
} catch {
previous = "";
}
if (previous === source) return false;
writeFileSync(path, source);
return true;
};

for (const { dir, folder, route } of PACKAGES) {
const sourcePath = `packages/${dir}/CHANGELOG.md`;
const pkgName = JSON.parse(
readFileSync(resolve(repoRoot, "packages", dir, "package.json"), "utf8"),
Expand All @@ -106,35 +136,67 @@ try {
lastUpdated = "";
}

const source = renderPage({
const title = dir === "gmt" ? "Changelog" : `Changelog: ${dir}`;
const shared = {
pkgName,
title: dir === "gmt" ? "Changelog" : `Changelog: ${dir}`,
description: describePage(pkgName, groups),
groups,
formatDate: (stamp) => gmt.parseDateFromUtc(stamp),
sourceUrl: `${SOURCE_BASE}/${sourcePath}`,
sourcePath,
installLink: installLinkFor(dir),
lastUpdated,
});
route,
};

// Idempotent write: don't bump mtime when nothing changed.
const outPath = resolve(outDir, out);
let previous = "";
try {
previous = readFileSync(outPath, "utf8");
} catch {
previous = "";
let written = write(
resolve(outDir, folder, "index.md"),
renderIndexPage({
...shared,
title,
description: describePage(pkgName, groups),
lastUpdated,
}),
);
const lines = new Set(
releaseLines(groups).flatMap((group) =>
group.lines.map(({ line }) => line),
),
);
for (const line of lines) {
const changed = write(
resolve(outDir, folder, `${lineSlug(line)}.md`),
renderLinePage({
...shared,
title: `${title} ${line}`,
indexTitle: title,
line,
}),
);
written ||= changed;
}
if (previous !== source) writeFileSync(outPath, source);

const untagged = groups
.flatMap((group) => group.releases)
.filter((release) => release.stamp === null).length;
console.log(
`changelog: ${dir} ${versions.length} versions, ${groups.length} scopes, ${untagged} untagged (${previous === source ? "unchanged" : "written"})`,
`changelog: ${dir} ${versions.length} versions, ${groups.length} scopes, ${lines.size} line pages, ${untagged} untagged (${written ? "written" : "unchanged"})`,
);
}

// Delete what this run did not write: a page of a line that no longer exists, or the
// single-file layout of an earlier build.
const sweep = (directory) => {
for (const entry of readdirSync(directory, { withFileTypes: true })) {
const path = resolve(directory, entry.name);
if (entry.isDirectory()) {
sweep(path);
if (readdirSync(path).length === 0) rmSync(path, { recursive: true });
} else if (entry.name.endsWith(".md") && !kept.has(path)) {
rmSync(path);
console.log(`changelog: removed stale ${relative(outDir, path)}`);
}
}
};
sweep(outDir);
} catch (error) {
console.error(error instanceof Error ? error.message : String(error));
process.exit(1);
Expand Down
21 changes: 18 additions & 3 deletions apps/dox/scripts/build-industry-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

import { readdirSync, readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { dirname, relative, resolve } from "node:path";
import { fileURLToPath } from "node:url";

import { INDUSTRY_OVERVIEWS } from "../src/lib/industry-overview";
Expand All @@ -26,11 +26,17 @@ import {
type HubIndustry,
type HubSectionPage,
} from "./build-utils/industry-pages";
import {
loadCommitDates,
newestCommit,
withLastUpdated,
} from "./build-utils/commit-dates.mjs";
import { syncTree, writeIfChanged } from "./build-utils/generated-files.mjs";
import type { IndexedPage } from "./build-utils/index-pages";
import { readSectionPage } from "./build-utils/industry-sidebar";

const appRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const repoRoot = resolve(appRoot, "..", "..");
const docsDir = resolve(appRoot, "src", "content", "docs");
const corpusFile = resolve(
appRoot,
Expand All @@ -48,12 +54,13 @@ const pages: IndexedPage[] = (
JSON.parse(readFileSync(corpusFile, "utf8")) as CorpusFunction[]
)
.filter((entry) => entry.kind === "function")
.map(({ namespace, module, name, url, description }) => ({
.map(({ namespace, module, name, url, description, sourcePath }) => ({
namespace,
module,
name,
url,
description,
sourcePath,
}));

const industries: HubIndustry[] = INDUSTRIES.map((industry) => {
Expand Down Expand Up @@ -94,6 +101,7 @@ function sectionPages(section: string): HubSectionPage[] {
title: page.title,
description: page.description,
industries: page.industries,
path: relative(repoRoot, resolve(dir, file)).split("\\").join("/"),
};
});
}
Expand All @@ -104,9 +112,16 @@ const hubs = renderIndustryHubs({
sectionPages: HUB_SECTIONS.flatMap(({ section }) => sectionPages(section)),
});

// Each hub is dated from the files it states (`build-utils/commit-dates.mjs`), read in one `git log`.
loadCommitDates(hubs.flatMap((hub) => hub.inputs));
const changes = syncTree(
resolve(docsDir, "industries"),
new Map(hubs.map((hub) => [hub.file, hub.mdx])),
new Map(
hubs.map((hub) => [
hub.file,
withLastUpdated(hub.mdx, newestCommit(hub.inputs)),
]),
),
);
const sidebarWritten = writeIfChanged(
resolve(appRoot, "src", "generated", "industries-sidebar.ts"),
Expand Down
Loading
Loading