Skip to content

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.

  • mise, which installs the versions of Node and pnpm that mise.toml at 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.

Run these commands once, in console/:

Terminal window
mise install
pnpm install --frozen-lockfile

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.

Terminal window
pnpm type-check
pnpm lint
pnpm format:check
pnpm test:run
pnpm build
  • pnpm lint:fix fixes what the linter can fix.
  • pnpm format writes the format of every file.
  • pnpm test:run runs the tests of Node first, then the tests of Vitest, both with the time zone set to UTC.
Terminal window
pnpm build

The 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.

Terminal window
pnpm check:same-build

To 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:

Terminal window
TADORU_API_URL=http://127.0.0.1:8080 pnpm serve:csp

The 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.

The types of the API come from the OpenAPI document of the server. After the server changes, read them again in two steps:

Terminal window
pnpm api:fetch
pnpm api:types
  1. pnpm api:fetch reads the document of a running server into tests/fixtures/openapi.json. It reads the address in TADORU_OPENAPI. Without it, the command reads http://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.
  2. pnpm api:types writes the client and the types to lib/api/gen/, from that file only.