docs: add TSDoc across public APIs and auto-publish TypeDoc site#5
Merged
docs: add TSDoc across public APIs and auto-publish TypeDoc site#5
Conversation
Every exported function, type, and singleton in the library now has a TSDoc block: concise imperative-mood descriptions, realistic domain examples for user-facing functions (orders, users, HTTP, payments), and explicit notes for edge cases (`chunk` RangeError, `minBy`/`maxBy` empty behaviour, `fromZod` async-schema throw, `allWithConcurrency` rejection semantics, `Records.get`/`getOr` own-property-only scope). Covers all 13 namespaces: pipe, Result, ResultAsync, Option, Arrays, Records, Strings, Predicates, Functions, Brand, NonEmptyArray, Tagged, interop/zod. 109 TSDoc blocks total. On overloaded functions the block sits on the first overload only; implementation signatures and internal helpers (isFn, sleep, run closures) are left undocumented. Wire TypeDoc for a generated API site: - `pnpm docs` / `pnpm docs:watch` scripts run typedoc against every subpath entry point. - `typedoc.json` config pins output to `packages/plainfp/docs/api`, excludes private/internal, validates missing/invalid links. - `.github/workflows/docs.yml` builds and deploys to GitHub Pages on every push to main via the standard actions/deploy-pages flow (actions pinned by SHA, tokenless via OIDC). - `vite.config.ts` fmt + lint now ignore `docs/api/**` so generated HTML does not trip formatter/linter. - `.gitignore` excludes `packages/*/docs/api/`. Adds a docs badge pointing at https://kelsos.net/plainfp/ (inherits the user-level Pages custom domain on kelsos.github.io). Consumers now get hover tooltips in editors everywhere, the emitted .d.ts files carry the docs forward for downstream tooling, and a searchable API reference site publishes automatically on every merge. Dist grows 114 KB to 180 KB unminified (the cost of shipping the documentation inline with the types). No runtime code changed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
=======================================
Coverage 86.41% 86.41%
=======================================
Files 20 20
Lines 346 346
Branches 71 71
=======================================
Hits 299 299
Misses 19 19
Partials 28 28
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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
Two related changes landing together:
main.What consumers get
.d.tsfiles carry the TSDoc forward, so downstream tooling (language servers, api-extractor, typedoc consumers) sees the same comments.kelsos.github.io). Refreshes automatically on each merge.TSDoc style choices
@exampleblocks only on user-facing functions; trivial type guards and obvious aliases get one-liner descriptions.@param/@returnsthat just restate the TS signature.isFn,sleep,runclosures) are left undocumented.foo/bar/baz.Edge cases explicitly documented
chunk→RangeErroron fractional/zero/negative sizesminBy/maxBy→Option<T>,noneon empty inputfind/findIndex→ returnOption(replacing nativeundefined/-1)fromZod→ throws a wrapped error on async schemas; points atfromZodAsyncallWithConcurrency→ swallows factory rejections (usefromPromiseto preserve)Records.get/getOr→ own properties only, prototype chain is skippedunique/uniqueBy→ SameValueZero semantics (NaN=NaN, +0=-0)tag→ data cannot hijack_tag;Tagged<Tag, Data>omits_tagfromDataTypeDoc wiring
pnpm docs/pnpm docs:watchscriptstypedoc.jsonpins entry points (every subpath export), excludes private/internal, validates linksdocs.ymlworkflow: build + deploy viaactions/configure-pages+actions/upload-pages-artifact+actions/deploy-pages(SHA-pinned, tokenless OIDC, concurrency-guarded).gitignoreexcludespackages/*/docs/api/;vite.config.tsfmt+lint ignore the same pathDist size impact
plainfpgrows from 114 KB → 180 KB unminified. This is the cost of shipping TSDoc inline with the.d.tsfiles. Minified + gzipped size is roughly proportional. For a docs-heavy library this is worth it — consumers who care about raw size can use a bundler that strips comments at build.No runtime code changed
Purely comments + config + new tooling wiring. All 177 tests still pass, typecheck clean, attw clean, publint clean.
Test plan
docs.ymldeploys successfully on merge tomain(first run establishes the Pages site)plainfpimports show the TSDoc content (can verify locally:pnpm build && cd packages/plainfp/dist && ls *.d.ts)