How the Plugins Fit Together
ZIO SBT splits the build of a ZIO library into three sbt plugins that each own one concern, an optional fourth that checks Scaladoc examples, and two modules that support them.
One Plugin per Concernโ
The ecosystem plugin owns how the code is compiled and checked. It decides the Scala versions, the compiler options and the fmt, lint and prepare commands, so every ZIO library builds the same way.
The website plugin owns the documentation. It compiles the Markdown in docs/ with mdoc, so every Scala example is type-checked, and wraps the result in a Docusaurus website. It also generates the README.md from docs/index.md, so the README and the first page of the website never disagree.
The CI plugin owns the GitHub workflows. It describes the whole pipeline in Scala, using the model of zio-sbt-githubactions, and writes the YAML files that GitHub runs. The workflow calls back into the other plugins: the lint job runs the lint command of the ecosystem plugin, and the build job runs the website build.
How Documentation Reaches zio.devโ
A documentation change travels through four stages:
compileDocsruns mdoc overdocs/and writes the compiled pages towebsite/docs.- On a release, the
release-docsjob publisheswebsite/docsto npm as the package@zio.dev/<project>. - The
notify-docs-releasejob tells thezio/ziorepository that a new version of the package exists. - The ZIO website, built from
zio/zio, picks up the new package version and shows the pages underzio.dev/<project>/.
The first stage runs on a laptop, which is why previewWebsite can show the same pages locally. The other three run in CI.
Source Embeddingโ
zio-sbt-source is not a plugin. It is a library on the classpath of the docs project, so mdoc can load its mdoc:embed modifier. Embedding examples from real source files keeps the documentation compiling against the code it describes.
Scaladoc Examplesโ
The Scaladoc plugin is optional. Loading it gives every module a scaladocCheck task that compiles the code examples in its Scaladoc comments, like mdoc does for the Markdown in docs/. The CI plugin runs it in the build job when ciCheckScaladocExamples is on. See the ZIO SBT Scaladoc reference.