Skip to main content

This site

The site is built with Docusaurus, as wirespec's is, from the site folder of the repository. It needs Node.js 20 or later. Of the Gradle build it needs one file, for the playground.

In site/
docs/The pages, in Markdown.
sidebars.tsThe order of the pages in the sidebar. A new page has to be added to it.
docusaurus.config.tsThe title, the navigation bar, the footer and the address of the site.
src/pages/index.tsxThe home page.
src/pages/playground.tsx, src/playground/The playground.
src/css/custom.cssThe colors: the black and yellow of Flock.
src/theme/prism-include-languages.tsThe colors of a dsl code block.
static/The logo and the other files that are served as they are.

Write a page​

./gradlew :playground:sitePlayground
cd site && npm install
npm start

That serves the site at http://localhost:3000 and shows a change as soon as it is saved. Every page has an Edit this page link to its file on GitHub.

A code block in the DSL takes dsl as its language. It is colored the way the language server colors a script, with the one difference of the Orca plugin: a call is a keyword only when its arguments and the { are on the line of its name.

DSL_LANG_VERSION between double braces in a page is the version of the release the site is published for. The pipeline passes it as VERSION; a build without it shows 0.0.0-SNAPSHOT.

The playground​

The playground has two editors: a schema on the left, and a script that is checked against it on the right. Nothing of the language is written again for the site: the page runs the language server itself, compiled to JavaScript, in a web worker, and the editor of the script is its client. It opens the script, sends each change, and shows what the server answers: the diagnostics, the semantic tokens, the folding ranges and the completion. The schema is a file of the server, .dsl/shop.json next to the script. The worker keeps it, and a change of it is a workspace/didChangeWatchedFiles.

playground/The Gradle module that compiles the server for the browser: languageServer, in Playground.kt.
site/src/playground/dist/dsl-playground.jsWhat it compiles to. ./gradlew :playground:sitePlayground writes it; it is not in the repository, and the site does not build without it.
site/src/playground/server.worker.tsThe worker the server runs in, with the files it reads.
site/src/playground/client.tsThe client: JSON-RPC with the worker.
site/src/playground/Playground.tsxThe page: two CodeMirror editors, and what is wrong below each.
site/src/playground/example.tsThe schema and the script the playground opens with. The script has to satisfy the schema.

After a change to the language or the server, run ./gradlew :playground:sitePlayground again to see it in the playground. The playground shows the version of the server: pass -Pversion=... to that task to set it.

Build it​

npm run build

The build writes the site to site/build, and fails on a link to a page or a heading that does not exist. npm run serve serves that folder, to see the site as it will be published.

How it is published​

The site job of the pipeline compiles the language server of the playground and builds the site on every push and every pull request, and keeps it as the github-pages artifact. When a version of main is released, the deploy-site job puts that build on GitHub Pages, so a change to a page is live with the next release.

The repository has to have Settings > Pages > Source set to GitHub Actions, and the github-pages environment under Settings > Environments has to allow deployments from the tags v*: a release runs for its tag, not for main. The pipeline asks GitHub Pages for the address of the site and builds the site for it, so a custom domain is set there and nowhere else.