ci(docs): #102-docs-strategy generate API reference with TypeDoc - #129
Open
elycruz wants to merge 1 commit into
Open
ci(docs): #102-docs-strategy generate API reference with TypeDoc#129elycruz wants to merge 1 commit into
elycruz wants to merge 1 commit into
Conversation
Chooses TypeDoc as the documentation rendering strategy, wires it up, and
adds a release-triggered GitHub Pages publish workflow.
All three candidates were run against this working tree:
- `deno doc` (the issue's initial suggestion) hard-fails on
`fjl-validator-recaptcha`, which imports the Node builtins `https` and
`querystring` without the `node:` prefix Deno requires. On `fjl` alone it
needs `--unstable-sloppy-imports` because the sources use extensionless
relative imports; without that flag it exits 0 and emits an empty site.
That is exactly what the untracked `docs/` directory at repo root contains
- `deno doc --html` output from 2024-05-28 with `{"nodes":[]}`.
- api-extractor works but reads `.d.ts`, so it needs a build first, and
`fjl-validator-recaptcha` is commented out of `rollup.config.mjs`. It also
emits 416 `ae-missing-release-tag` warnings for `fjl` alone and produces
JSON, not a site.
- TypeDoc ran clean on all four published packages, from sources, with no
build and zero warnings: 502 files, 489 symbol pages, 4 modules, ~2s.
Changes:
- add `typedoc` devDependency, `typedoc.json`, `tsconfig.docs.json`
- add root `docs` script (invoke as `pnpm run docs`; bare `pnpm docs` is
swallowed by npm's built-in `docs` command)
- output to `docs-dist/`, gitignored and eslint-ignored, so it does not
collide with the legacy `docs/` directory
- add `.github/workflows/docs.yml`, triggered on `release: [created]` to
match `publish.yml`, plus `workflow_dispatch`
- record the comparison and decision in
`md/adr/0001-documentation-generation-strategy.md`
The legacy `docs/` directory is deliberately left alone; its removal is
recorded as a follow-up in the ADR.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Chooses TypeDoc as the documentation rendering strategy for the monorepo, implements it, and adds a release-triggered GitHub Pages publish workflow.
All three candidates were run against this working tree, not evaluated from their docs. The result overturns the issue's initial recommendation.
Closes #102
Work unit:
102-docs-strategyThe finding that decided it
The repo already has an untracked
docs/directory at root, dated 2024-05-28, matched by the**/docsline in.gitignore. Its file signature (all_symbols.html,fuse.js,search_index.js,styles.css) identifies it asdeno doc --htmloutput — so the Deno path in this issue was not just proposed, it was tried.It documents nothing:
Reproduced today with Deno 2.4.2 — the tool exits successfully and emits a complete-looking 13-file site with zero symbols:
Cause:
fjluses extensionless relative imports (import {reduce} from "../list/utils") throughout, which Deno's resolver rejects — silently, fordeno doc. The maintainer's own note onorigin/feat/#55/deno_support(node_scripts/tasks/fjl-deno.json.mjs, commitad4076b5) confirms this was the known blocker; it's a stub whose whole body is a comment describing an unwritten script to synthesizedeno.json.importsso "all source imports work as they are (without file extensions)".Options, as actually run
deno doc--unstable-sloppy-importsfixes the single-package case:The multi-package case fails outright:
No output.
fjl-validator-recaptchaimports the Node builtinshttpsandquerystringwithout thenode:prefix Deno requires.deno docalso has no concept of packages — multiple entry points flatten into one namespace.api-extractor + api-documenter
Run for real against
packages/fjl/dist/esm/index.d.tsafter a fullpnpm build:416
ae-missing-release-tagwarnings forfjlalone; requires a build (andfjl-validator-recaptchais commented out ofrollup.config.mjs, so it can't be documented at all); produces JSON, not a site — rendering needs api-documenter (Markdown) plus an SSG.TypeDoc
Clean on all four published packages, first attempt, from sources, no build, zero warnings. See evidence below.
Comparison
deno docfjl-validator-recaptchafjl-validator-recaptchaimpossible (not built)fjlonly, w/ unstable flag)fjlonly, as JSON)pnpm buildfirst--unstable-sloppy-importsfjlonly)node:prefixes; import mapDecision: TypeDoc
deno docerrors onfjl-validator-recaptcha; api-extractor can't see it because rollup doesn't build it.pnpm run docsis independent ofpnpm build, so it can't publish docs for a staledist/.pnpm ithe release workflow already runs, using the same TypeScript 5.4 as build and tests.modules/entries.Full reasoning:
md/adr/0001-documentation-generation-strategy.md.Known limitation, shared by every candidate
Neither TypeDoc nor
deno docpicks up a doc comment placed inside a multi-declaratorexport constlist:115 files use this shape and their prose is dropped by both tools equally — verified:
fjl.filterrenders without a description under TypeDoc and underdeno doc, whilefjl.mapObj(classic/** */ export constplacement) renders correctly under both. It's a source-comment-placement problem, not a tool-selection one. Filed as follow-up 2 below.Changes
typedoc.json— 4 entry points (one per published package), outputdocs-dist/, rootREADME.mdas the landing page, GitHub/npm nav links.tsconfig.docs.json— docs-only tsconfig;pathsmapsfjl/fjl-validator/fjl-inputfilter/fjl-validator-recaptchato theirsrc/index.ts, so cross-package imports resolve without a build.package.json— addstypedoc@^0.25.13devDependency and adocsscript. Additive only, to stay out of the way of the concurrentscriptsedit.pnpm-lock.yaml— regenerated for the new devDependency..gitignore/.eslintignore— ignoredocs-dist/. Without the eslint entry, 502 generated files would be linted..github/workflows/docs.yml— new.release: [created](matchingpublish.yml) +workflow_dispatch; Node 20 / pnpm 8 /HUSKY: 0, consistent with the existing workflows;pages: write+id-token: writeOIDC permissions;concurrency: pages; a guard step that fails loudly ifdocs-dist/index.htmlis missing;upload-pages-artifact→deploy-pages.md/adr/0001-documentation-generation-strategy.md— the ADR. Newmd/adr/directory alongside the existingmd/issues/.Gotcha worth knowing
pnpm docsdoes not work — usepnpm run docs. pnpm forwards unrecognized commands to npm, andnpm docsis a real command (opens a package homepage), so barepnpm docsexits 0 and generates nothing:The workflow uses
pnpm run docs, and it's noted in the ADR and in a workflow comment.Evidence the generator actually ran
489 symbol pages across 4 modules. Rendered content spot-check (tags stripped):
$-prefixed curried variants render under their real names ($filter,$map); only the filename is sanitized to_filter.html.Verification
pnpm run docspnpm testpre-pushhook)pnpm buildpre-pushhook)pnpm lintdocs-dist/present, confirming the.eslintignoreentry worksgit statuswithdocs-dist/presentjobs: [build-docs, deploy-docs],on: [release, workflow_dispatch]No commit or push hooks were bypassed —
commit-msg,pre-commit, andpre-pushall ran and passed.Manual follow-up required
GitHub Pages must be enabled before
docs.ymlcan deploy. Deliberately not done here — it's an outward-facing settings mutation on a public repo.Click-path: Settings → Pages → Build and deployment → Source → "GitHub Actions"
Or, for a maintainer with admin scope:
gh api -X POST repos/functional-jslib/fjl/pages \ -f 'build_type=workflow'(Use
-X PUTinstead of-X POSTif Pages is already enabled with a different source.)Until that's done,
build-docssucceeds and uploads the artifact whiledeploy-docsfails with a clear Pages-not-enabled error. The workflow is added, not triggered — nothing has been published as part of this PR.Recommended follow-up issues
docs/directory. It'sdeno docoutput from 2024-05-28 containing zero symbols, and its vendoredfuse.js/script.js/search.jsare the source of most of the repo's eslint errors on checkouts where it exists. Left untouched here on purpose; the new generator writes todocs-dist/specifically to avoid the collision./** */inside a multi-declaratorexport const, so the prose reaches the rendered site. This is the single highest-value change for docs quality and it's renderer-independent.node:prefixes tohttps/querystringinpackages/fjl-validator-recaptcha/src/index.ts— correct regardless of the docs decision, and it unblocks Deno consumers.fjl-validator-recaptchainrollup.config.mjs— it's published to npm but not built..api.mdreport would catch accidental breaking changes at release time. That's its real strength, and a legitimate future need — just not the problem CI/CD: Choose documentation generating strategy #102 poses.