Skip to content

fix: resolve Cookbook from the site for content outside it, and docs precision fixes - #216

Merged
tenphi merged 2 commits into
mainfrom
claude/docs-verification-fixes
Nov 24, 2026
Merged

tenphi merged 2 commits into
mainfrom
claude/docs-verification-fixes

Conversation

@tenphi

@tenphi tenphi commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Why

Two things that #214 left out:

  1. A real bug the docs review surfaced.
    • docs/custom-components.md says to put a component in docs/components/StatusBadge.ts and import it from an MDX page.
    • In a site created with --source, docs/ sits in the repository, outside the site's folder. Node resolution from there cannot reach the site's node_modules.
    • So astro dev and astro build both fail:
      Rolldown failed to resolve import "@tenphi/cookbook/styling" from ".../repo/docs/components/StatusBadge.ts".
    • I reproduced this in a --source site installed from the packed packages. MDX pages themselves were fine, because Cookbook resolves their imports from the site.
  2. The verification round's fixes. docs: one guide for people and agents, and a whole-docs review #214 was squash-merged moments before its last commit landed.

What changes

Fix (@tenphi/renderer)

  • The integration adds @tenphi/cookbook to Vite's resolve.dedupe in the resolve block it already configures. Cookbook's own entries then resolve from the site for every importer.
  • The existing server-side dedupe filter only removes react and react-dom, so the two don't interact.
  • Regression test: check:development already keeps content in ../content, outside the site. It now writes docs/components/badge.js there, imports it from an MDX page, and checks the page on the dev server and in the production build.
    • Without the fix: Cannot find module '@tenphi/cookbook/styling' imported from '.../content/docs/components/badge.js'.
    • With the fix: it passes.
  • custom-components.md: a component outside the site resolves @tenphi/cookbook from the site. Any other package it imports resolves from the module's own folder.
  • Patch changeset for @tenphi/renderer.

Docs precision fixes (from the verification round)

  • configuration.md:
    • the brand contrast value is a target, not a floor;
    • a site-wide tableOfContents: false gives way to a page's own setting.
  • theme-and-components.md: a brand target matters only above the built-in floors.
  • cli.md: astro dev stops on the contrast errors too.
  • troubleshooting.md: doctor prints the page count on success or with --json.
  • architecture.md: Markdown copies are conditional, and "default sources" replaces "convention-mode".
  • custom-components.md: the TypeScript ESLint entry is added beside the .js/.mjs entry, not used instead of it.

Checks

  • check:development fails before the fix and passes after it, in both dev and build.
  • A --source site created by the local creator and installed from freshly packed tarballs builds with docs/components/StatusBadge.ts, with no workaround in its astro.config.ts. The badge renders, and its CSS is extracted.
  • prettier --check and cookbook doctor with fragment checks pass.
  • The full build, lint, renderer typecheck and tests, check:theming and check:authoring run in CI.

Entropy

Slightly Decreased. Sites whose content lives outside their folder no longer need a per-site Vite workaround, and the documented component pattern works in every layout. The fix is one option in the layer that owns module resolution, with no new API or configuration.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gr8S7DePcxFzSN3gkPVNcb

- configuration.md: the brand contrast value is a target, not a floor;
  a site-wide tableOfContents: false yields to a page's own setting.
- theme-and-components.md: a brand target matters only above the
  floors, so the default changes nothing.
- cli.md: astro dev stops on the contrast errors too.
- troubleshooting.md: doctor prints the page count on success or with
  --json.
- architecture.md: Markdown copies are conditional too; "default
  sources" replaces the old convention-mode term.
- custom-components.md: the TypeScript ESLint entry is added, not a
  replacement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7DePcxFzSN3gkPVNcb
…side it

A component module beside content outside the site's folder, such as
docs/components/StatusBadge.ts in a site created with --source, failed
in astro dev and astro build: Node resolution from that folder cannot
reach the site's node_modules, so `@tenphi/cookbook/styling` was not
found. MDX pages were unaffected, which is why the custom components
guide looked right.

The integration now adds `@tenphi/cookbook` to Vite's resolve.dedupe,
so Cookbook's own entries resolve from the site for every importer.
The existing server-side filter only removes react and react-dom.

check:development puts a component module in its external content root
and checks it on the dev server and in the build; it failed without the
fix. The custom components guide says other packages a component
imports resolve from the module's own folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7DePcxFzSN3gkPVNcb
@tenphi tenphi changed the title docs: precision fixes from the verification round fix: resolve Cookbook from the site for content outside it, and docs precision fixes Nov 24, 2026
@tenphi
tenphi merged commit e5c9694 into main Nov 24, 2026
12 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants