Ship bundled .d.ts types + hosted TypeDoc API reference#128
Merged
PAMulligan merged 6 commits intoJun 17, 2026
Merged
Conversation
Planning docs for #44: single bundled index.d.ts via vite-plugin-dts, TypeDoc HTML hosted at /api/ on the docs domain, and a CI doc-coverage gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace 'tsc --emitDeclarationOnly' (a 37-file .d.ts tree) with vite-plugin-dts (bundleTypes via api-extractor), producing a single dist/index.d.ts. Add an index.d.cts twin plus per-condition exports so CJS 'require' consumers resolve types. Add check:exports (publint --strict + attw) verifying the '.' entry resolves across node10/node16/bundler. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add TSDoc summaries to every export reachable from src/index.ts (ChatWidget + props, WidgetPosition, translations/i18n, locales, triggers, theme + tokens, ChatApiClient + options, error classes, and the message/source/request/response types) and export ResolveTranslationsOptions. Add typedoc.json that emits an HTML reference to dist/api and gates documentation coverage via validation.notDocumented + treatWarningsAsErrors. New scripts: docs:api (HTML) and docs:api:check (validate-only). pnpm docs:api:check passes with 0 warnings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…debar Add docs/scripts/copy-api.mjs to copy ../widget/dist/api into public/api during the docs build (tolerant: warns and skips when the reference is absent, so docs-only local builds still work). Wire it into the build script, gitignore the generated public/api/, and add a 'Generated Reference (TypeDoc)' entry under the API Reference sidebar group linking to /api/. Verified the docs build emits dist/api/index.html. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…cs build Widget CI now runs 'pnpm docs:api:check' (fails on any undocumented public export or broken @link) and 'pnpm check:exports' (publint + attw) after the build. The Docs workflow installs the widget and runs 'pnpm docs:api' before building so the generated HTML reference ships with the Cloudflare Pages deploy, and now also triggers on widget/** changes so the reference rebuilds when the public API changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5 tasks
Storybook's Vite builder loads vite.config.ts, so vite-plugin-dts ran during 'storybook build' and failed: api-extractor looked for dist/index.d.ts, which only the library build produces. Guard the dts plugin behind process.env.STORYBOOK so it runs only for the library build. Verified locally: 'pnpm build' still emits dist/index.d.ts (+ .d.cts) and 'pnpm build-storybook' now succeeds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying chat-widget with
|
| Latest commit: |
df0a03e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f888a310.chat-widget-ejc.pages.dev |
| Branch Preview URL: | https://44-ship-dts-types-and-genera.chat-widget-ejc.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Guarantees consumers of
claudius-chat-widgetget full TypeScript IntelliSense, and adds an auto-generated, hosted API reference built from TSDoc.dist/index.d.tsviavite-plugin-dts(bundleTypes), replacing the old 37-filetsc --emitDeclarationOnlytree. A byte-identicalindex.d.ctstwin plus per-conditionexportsmake CJSrequireconsumers resolve types correctly.src/index.ts(component + props, hooks, theme + tokens, i18n, locales, API client, errors, message/source types).pnpm docs:apiruns TypeDoc and emits HTML towidget/dist/api.claudius-docs.pages.dev/api/: the docs build copies the HTML into the Astro site (one domain, one deploy) and the sidebar links it under API Reference with atypedocbadge.docs:api:checkfails on any undocumented public export (or broken@link);check:exports(publint+attw) proves the published types resolve.Acceptance criteria
index.d.tsbundlepnpm docs:apiruns TypeDoc and outputs HTML todist/apiVerification
pnpm build→ onlydist/index.d.ts+dist/index.d.cts(no stray tree).pnpm check:exports→ publint clean; attw green for.across node10 / node16 (CJS+ESM) / bundler.pnpm docs:api:check→ 0 warnings (gate green)./api/reference (all exports; per-prop docs with@defaultValueand{@link}cross-refs) and the docs sidebar link.Notes
/api/is collision-free with the existing/api/restand/api/widgetcontent routes../embed(IIFE script) and./style.cssentrypoints, which are intentionally typeless.mainafter merge (now also triggered bywidget/**).docs/plans/2026-06-16-typescript-types-api-reference*.md.Closes #44
🤖 Generated with Claude Code