From 4998e46f6f0ba0d75edb2f15adc7abd28a341848 Mon Sep 17 00:00:00 2001 From: Benoit TRAVERS Date: Sun, 28 Jun 2026 23:51:43 +0200 Subject: [PATCH 1/2] docs: adopt @btravstack/theme as a real npm dependency Replace the jsDelivr-pinned `custom.css` import with the published `@btravstack/theme` VitePress theme, keeping these docs in visual sync with the landing page and the other btravstack projects through a versioned package instead of a CDN URL pinned to a tag. - docs/.vitepress/theme/index.ts: `export default` the shared theme (which extends VitePress's default theme + layers the design tokens) - remove docs/.vitepress/theme/custom.css (the old jsDelivr @import) - add @btravstack/theme ^1.2.0 to @amqp-contract/docs - exempt @btravstack/theme from the release-age gate (first-party pkg) Verified: vitepress build emits the 1.2.0 tokens (--accent #E0589A, --display-accent #E0589A, --text-accent #D6246F light / #E0589A dark). Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/.vitepress/theme/custom.css | 9 --------- docs/.vitepress/theme/index.ts | 7 ++----- docs/package.json | 1 + pnpm-lock.yaml | 12 ++++++++++++ pnpm-workspace.yaml | 1 + 5 files changed, 16 insertions(+), 14 deletions(-) delete mode 100644 docs/.vitepress/theme/custom.css diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css deleted file mode 100644 index 2b90513f..00000000 --- a/docs/.vitepress/theme/custom.css +++ /dev/null @@ -1,9 +0,0 @@ -/** - * btravstack shared design system. - * Keeps these docs in visual sync with the landing page and the other - * btravstack projects. Source of truth: - * https://github.com/btravstack/btravstack.github.io/tree/main/theme - * Pinned to an immutable commit SHA for reproducible builds — to pull in - * upstream token changes, bump the SHA below. Do not fork colors here. - */ -@import "https://cdn.jsdelivr.net/gh/btravstack/btravstack.github.io@v1.0.0/theme/vitepress.css"; diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 741b3811..de50c2e0 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,6 +1,3 @@ -import DefaultTheme from "vitepress/theme"; +import Theme from "@btravstack/theme"; -// eslint-disable-next-line sort-imports this CSS import must come after DefaultTheme so that it can override -import "./custom.css"; - -export default DefaultTheme; +export default Theme; diff --git a/docs/package.json b/docs/package.json index 3a1eea93..c1ae2a61 100644 --- a/docs/package.json +++ b/docs/package.json @@ -21,6 +21,7 @@ }, "devDependencies": { "@amqp-contract/tsconfig": "workspace:*", + "@btravstack/theme": "^1.2.0", "@types/node": "catalog:", "mermaid": "catalog:", "tsx": "catalog:", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 506165eb..cd631f0e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -177,6 +177,9 @@ importers: '@amqp-contract/tsconfig': specifier: workspace:* version: link:../tools/tsconfig + '@btravstack/theme': + specifier: ^1.2.0 + version: 1.2.0(vitepress@1.6.4(@algolia/client-search@5.53.0)(@types/node@24.13.2)(lightningcss@1.32.0)(postcss@8.5.15)(typescript@6.0.3)) '@types/node': specifier: 24.13.2 version: 24.13.2 @@ -809,6 +812,11 @@ packages: '@braintree/sanitize-url@7.1.2': resolution: {integrity: sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA==} + '@btravstack/theme@1.2.0': + resolution: {integrity: sha512-T6zN2V8xPY3ohlbjILbP01AMO1xbGl39HuPeVoY2qlJYTRVBRW3RBvuXJVeQAuRdLFcl0xTgFjzHsl9B8RLlkA==} + peerDependencies: + vitepress: ^1.6.0 + '@changesets/apply-release-plan@7.1.1': resolution: {integrity: sha512-9qPCm/rLx/xoOFXIHGB229+4GOL76S4MC+7tyOuTsR6+1jYlfFDQORdvwR5hDA6y4FL2BPt3qpbcQIS+dW85LA==} @@ -5607,6 +5615,10 @@ snapshots: '@braintree/sanitize-url@7.1.2': {} + '@btravstack/theme@1.2.0(vitepress@1.6.4(@algolia/client-search@5.53.0)(@types/node@24.13.2)(lightningcss@1.32.0)(postcss@8.5.15)(typescript@6.0.3))': + dependencies: + vitepress: 1.6.4(@algolia/client-search@5.53.0)(@types/node@24.13.2)(lightningcss@1.32.0)(postcss@8.5.15)(typescript@6.0.3) + '@changesets/apply-release-plan@7.1.1': dependencies: '@changesets/config': 3.1.4 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 572b59ce..9e6bd255 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -65,6 +65,7 @@ minimumReleaseAgeStrict: true # from the release-age maturity gate so freshly published versions can be adopted # immediately. minimumReleaseAgeExclude: + - "@btravstack/theme" - unthrown - "@unthrown/vitest" From b63609dcdd8de5aa1b4e7e1a53ed5913fefb6da1 Mon Sep 17 00:00:00 2001 From: Benoit TRAVERS Date: Mon, 29 Jun 2026 00:28:05 +0200 Subject: [PATCH 2/2] fix(docs): bundle @btravstack/theme for SSR and pin it via the catalog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the failing Build check and addresses review feedback. - CI: `vitepress build` failed with `ERR_UNKNOWN_FILE_EXTENSION` on the default theme's `fonts.css`. `@btravstack/theme` imports `vitepress/theme` (side-effect CSS) plus its own `style.css`; VitePress externalized the package during the SSR build, so Node's ESM loader hit the raw `.css`. Add it to `vite.ssr.noExternal` so Vite processes the CSS for the server bundle. - Review: move `@btravstack/theme` into the pnpm catalog as an exact pin (1.2.0) and reference `catalog:` from docs/package.json — single source of truth, consistent with the rest of the workspace. Verified: docs build completes and the 1.2.0 tokens (--accent #E0589A, --text-accent #D6246F) are emitted in the output CSS. Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/.vitepress/config.ts | 11 +++++++++++ docs/package.json | 2 +- pnpm-lock.yaml | 5 ++++- pnpm-workspace.yaml | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 7a393a4e..e990406d 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -70,6 +70,17 @@ export default withMermaid( class: "mermaid", }, + // `@btravstack/theme` imports `vitepress/theme` (which side-effect-imports the + // default theme's CSS) plus its own `style.css`. VitePress externalizes the + // package during the SSR build, so Node's ESM loader hits those `.css` files + // and throws `ERR_UNKNOWN_FILE_EXTENSION`. Mark it `noExternal` so Vite + // processes (and strips) the CSS for the server bundle instead. + vite: { + ssr: { + noExternal: ["@btravstack/theme"], + }, + }, + themeConfig: { // https://vitepress.dev/reference/default-theme-config logo: { light: "/logo-light.svg", dark: "/logo-dark.svg" }, diff --git a/docs/package.json b/docs/package.json index c1ae2a61..78276878 100644 --- a/docs/package.json +++ b/docs/package.json @@ -21,7 +21,7 @@ }, "devDependencies": { "@amqp-contract/tsconfig": "workspace:*", - "@btravstack/theme": "^1.2.0", + "@btravstack/theme": "catalog:", "@types/node": "catalog:", "mermaid": "catalog:", "tsx": "catalog:", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cd631f0e..f4932564 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,6 +9,9 @@ catalogs: '@asyncapi/parser': specifier: 3.6.0 version: 3.6.0 + '@btravstack/theme': + specifier: 1.2.0 + version: 1.2.0 '@changesets/cli': specifier: 2.31.0 version: 2.31.0 @@ -178,7 +181,7 @@ importers: specifier: workspace:* version: link:../tools/tsconfig '@btravstack/theme': - specifier: ^1.2.0 + specifier: 'catalog:' version: 1.2.0(vitepress@1.6.4(@algolia/client-search@5.53.0)(@types/node@24.13.2)(lightningcss@1.32.0)(postcss@8.5.15)(typescript@6.0.3)) '@types/node': specifier: 24.13.2 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 9e6bd255..08e2bfc2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -21,6 +21,7 @@ packages: catalog: "@asyncapi/parser": 3.6.0 + "@btravstack/theme": 1.2.0 "@changesets/cli": 2.31.0 "@commitlint/cli": 21.1.0 "@commitlint/config-conventional": 21.1.0