Packages
@strict-script/site
The website of strict-script: a front page, the documents of the repository as pages, and the playground. It is written as a folder of files that any server of files shows and that opens from the disk; it loads nothing from elsewhere, no CDN and no font.
pnpm build && pnpm site # writes dist/
pnpm site:serve # shows it at http://127.0.0.1:4173/
It is an adapter around the compiler, with no rule of the language in it, and it writes as little as it can by hand:
- The pages of the documentation are
docs/*.md,examples/README.md,CONTRIBUTING.mdand the README of each package, as they are at the commit the site is built from, and each example is a page that shows its sources. The whole documentation is in the site: a link to another document leads to its page, with its anchor, and a link to a file that is not a page is shown as its name, with no link. Only the foot names the repository. Two folders ofexamples/are kept out (KEPT_OUTinsrc/site.mjs): pieces of applications written again, which the documents that are pages do not name. A block of code with no language named is coloured as the language; one that is not code saystext. - The samples of the front page are judged by the compiler when the site is built (
src/demos: each as it compiles, a.stsfile, and as it is refused, a.refused.txt). What the page shows under a sample is what the command line prints. Once a sample is changed, the compiler is loaded in the page and asked again. - « A file becomes » shows the JavaScript and the declarations the compiler wrote for
src/demos/becomes.sts. - The promises and the questions are the sections of
README.md, not copies of them. - The words that are gone, the figures and the samples of the tour are found in
docs/language.mdand inREADME.mdwhen the site is built: a figure the README no longer gives stops the build. - The playground is a page of the site (
src/playground):engine.jscompiles a source and runs what was compiled,app.jsis the editor,tokens.jsthe colours of a text,examples/the examples it offers, each of which a test compiles and runs. A source handed in the address after#code=is opened, and « Copy link » writes that address. While a name is typed, or after a., the editor shows under the caret what may be written there, with the type of each: the list is the compiler's (complete), asked at each key, and the page only shows it. The arrows choose, Enter or Tab writes, Escape closes, and Ctrl + Space asks where nothing was typed: in a record, in a pattern, at the top of the file. - The search looks into every section of the documentation, in the page:
/opens it.
#One style
src/style.css is the one sheet of every page, the playground among them. Colours are named once, light then dark.
The bar at the top, the hero and the foot are the same in both themes, and so is the surface code is shown on
(.window, pre.code): the sample of the front page, a block of a document and the playground are the same thing
to the eye.
The order of the front page is that of typescriptlang.org: what the language is beside a sample, what it is in a few cards, how to start, what a file becomes, where it fits. There is no word of anyone who uses it, since nobody does yet.
The tests build the site and follow every link of it: a page or an anchor that is named and is not there fails
(test/site.test.ts).
#Online
Dockerfile at the root of the repository builds the site and serves dist/ with nginx: it is what a host that
builds from the repository is given.
It is on the Coolify of the house, at https://strict-script.adserver.fr: the site is public, the repository is
not, so the link of the foot to the sources answers on the local network only. A push to main builds and shows it
again (a webhook of the Gitea repository); the foot of each page names the commit it was built from.