Skip to content

Feature/ documentation site with type-checked examples - #5

Draft
stivens wants to merge 1 commit into
mainfrom
feature-gh-pages
Draft

stivens wants to merge 1 commit into
mainfrom
feature-gh-pages

Conversation

@stivens

@stivens stivens commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Motivation

All of CaseComplete's documentation lived in one long README.md. This PR adds a proper site, a landing page plus docs split into pages, in the style of Chimney's docs. It's hosted on GitHub Pages at https://stivens.github.io/CaseComplete/.

The library's main selling point is a compile error, so the site is built with mdoc. Every snippet is compiled against the current library, and the error examples (mdoc:fail) show real compiler output generated at build time. Docs can no longer silently drift from the code.

That paid off straight away: the README quick start never compiled. doobie has no Put[java.time.Year], so fr"release_year = $year" didn't type-check. The examples now use Int years.

What's included

Site (website/)

  • Landing page. The hero shows the real missing-field compile error. Below it:
    • a plain A => B function compared with a CaseComplete[A, B] parameter
    • the editor demo GIF
    • the features
    • install instructions
  • Docs pages:
    • Getting started
    • Why not pattern matching?
    • API reference, including a section showing each compile error the library reports
    • Type aliases
    • Compatibility
  • Theme: MkDocs Material with a custom light/dark palette, IBM Plex fonts, a logo and a favicon (website/docs/assets/).
  • Shared fixtures: the movie example types live in website/src/main/scala/examples/movies.scala, so several pages can import them instead of repeating the setup.

Build

  • project/plugins.sbt adds sbt-mdoc 2.9.2, which supports sbt 2.
  • build.sbt gets a new docs project:
    • It depends on casecomplete.jvm and adds doobie for the examples.
    • It is not part of root's aggregate, so sbt test and MiMa are unchanged.
  • New val latestRelease = "1.0.0". It's used both for the MiMa baseline and for @VERSION@ in the docs, so the site never advertises a version that isn't on Maven Central yet.

CI (.github/workflows/docs.yml)

  • Build: runs sbt docs/mdoc and then mkdocs build --strict on PRs and pushes that touch website/, src/main/, build.sbt, project/ or the workflow itself. A broken snippet fails the PR.
  • Deploy: pushes to main upload the site and deploy it to GitHub Pages.
  • sbt cache: the workflow uses its own sbt cache key. With ci.yml's key, whichever workflow finished first would decide what's in the cache.

README

  • Cut down to a short pitch, the GIF, install instructions and the quick start, with links to the site.
  • The GIF moved from screenshots/ to website/docs/assets/.

Preview locally

sbt docs/mdoc          # or "docs/mdoc --watch"
pip install -r website/requirements.txt
mkdocs serve -f website/mkdocs.yml

After merging

  • Set Settings → Pages → Source to GitHub Actions (or run gh api -X POST repos/stivens/CaseComplete/pages -f build_type=workflow). The first deploy fails until this is done.
  • Set the repo's Website field to https://stivens.github.io/CaseComplete/.

@stivens
stivens marked this pull request as draft October 2, 2026 17:51
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.

1 participant