Building and Testing the Console from Its Source
Use this page to build the console and run its checks. To run the console against a server while you change it, read Running the Console from Its Source.
What you need
Section titled “What you need”mise, which installs the versions of Node and pnpm thatmise.tomlat the root of the repository names.- A clone of the Tadoru repository. The console is its
console/directory.
Run every command on this page in console/, not at the root of the repository. To build the server
with this console, read
Build with the web console in the server
manual.
Install the tools and the packages
Section titled “Install the tools and the packages”Run these commands once, in console/:
mise installpnpm install --frozen-lockfileRun the checks
Section titled “Run the checks”All five checks must pass before each commit. CI runs them too, in the job console of
.github/workflows/ci.yml, on each pull request and each push to main.
pnpm type-checkpnpm lintpnpm format:checkpnpm test:runpnpm buildpnpm lint:fixfixes what the linter can fix.pnpm formatwrites the format of every file.pnpm test:runruns the tests of Node first, then the tests of Vitest, both with the time zone set to UTC.
Build the console
Section titled “Build the console”pnpm buildThe build checks the types, and writes the console to out/: one page, index.html, its copy
404.html, and the files of assets/. It also writes out/csp-hashes.json, which holds the
SHA-256 hashes of the styles that the server allows in its content security policy. If a page of
out/ holds an inline script, an event handler attribute such as onload, or a javascript:
link, the build stops. The policy of the server refuses each of them.
The image of the server copies the code of the console, but not tests/ or docs/.
Tailwind reads only the sources that app/globals.css names, and the image copies each of them.
To see that the files of the image give the same out/ as your checkout, run this command. It
builds a copy of the checkout and a copy of the files of the image, with the Node of your
machine. It does not run the build stage of the image itself. It prints the digest of each
out/. If the two builds differ, it names each file that differs and fails. It leaves your
out/ as it was.
pnpm check:same-buildTo open the build with the policy of the server, run this command. Set TADORU_API_URL to the
address of a server, as on Running the Console from Its Source:
TADORU_API_URL=http://127.0.0.1:8080 pnpm serve:cspThe console is then at http://127.0.0.1:3100/. Set PORT to use another port. Each address
of a page, such as http://127.0.0.1:3100/settings/dns/, opens that page, as on the server. A
missing file, such as /nothing.txt, gets the status 404.
The console has no release of its own. A build of the server builds this folder and embeds
out/. The tags of the console in this repository have the prefix console-, such as
console-v0.1.0-alpha.2. They name the releases of the old console repository.
Read the API types again
Section titled “Read the API types again”The types of the API come from the OpenAPI document of the server. After the server changes, read them again in two steps:
pnpm api:fetchpnpm api:typespnpm api:fetchreads the document of a running server intotests/fixtures/openapi.json. It reads the address inTADORU_OPENAPI. Without it, the command readshttp://127.0.0.1:8080/api/openapi.json. If the answer is not 200, or is not an OpenAPI document, the command stops and keeps the old file.pnpm api:typeswrites the client and the types tolib/api/gen/, from that file only.