Development¶
kikx is three Cargo packages and a Next.js app. Each one builds and tests on its own.
Before you start¶
You need:
a checkout of the kikx repository;
a Rust toolchain (
cargo,clippy,rustfmt);Node.js with
npm;Python 3, to build the documentation.
Check the Rust packages¶
Run the tests, clippy and rustfmt in each package:
cd cli && cargo test && RUSTFLAGS="-D warnings" cargo clippy --all-targets && cargo fmt --check
cd backend && cargo test && RUSTFLAGS="-D warnings" cargo clippy --all-targets && cargo fmt --check
cd backend/core && cargo test && RUSTFLAGS="-D warnings" cargo clippy --all-targets && cargo fmt --check
Tests live in each package’s tests/ directory, never in the source files.
Each package’s Cargo.toml turns on the unused-code lints, so clippy with -D warnings fails on
unused imports, variables and functions. cargo-machete
reports dependencies a package no longer uses; run cargo machete from the repository root. The
Rust workflow runs all of these checks on every pull request that touches backend/ or cli/.
Check the dashboard¶
cd web
npm install
npx tsc --noEmit
npm run lint
npm run build
Build the documentation¶
The documentation is built with Sphinx from docs/. Install the pinned dependencies once:
pip install -r docs/requirements.txt
Then build the English and French sites. Both treat warnings as errors:
make -C docs html
make -C docs html-fr
After changing an English page, refresh the French catalogues in docs/locales/fr/ and translate the new entries:
make -C docs update-po
To rebuild on every save while you write:
make -C docs serve
Update the screenshots¶
The screenshots of the web app in docs/source/images/web/ are made by one script,
docs/screenshots/capture.mjs. It drives the real app in a headless browser, builds the example
projects through the forms, and saves every picture four times: light and dark theme, English and
French. Pages show the one that matches the reader’s theme, and the French site uses the French
files.
File |
Theme |
Language |
|---|---|---|
|
light |
English |
|
dark |
English |
|
light |
French |
|
dark |
French |
You need Node.js and cwebp (brew install webp on macOS, apt install webp on Debian and
Ubuntu).
Start the backend and the dashboard, as in Run kikx locally.
Install the script’s dependencies and its browser once:
cd docs/screenshots npm ci npx playwright install chromium
Run it against the dashboard:
npm run capture -- --base http://localhost:3000
It replaces the files in docs/source/images/web/. To redo some of them only, pass their names
with --only, for example --only home,export-menu. --themes light and --locales en limit the
variants. Each shot is listed in docs/screenshots/shots.mjs, and the example projects it starts
from in docs/screenshots/scenes.mjs.
To add a screenshot to a page, add a shot, run the script, and put a light and a dark image on the page:
```{image} ../images/web/<name>.webp
:alt: What the picture shows
:class: only-light
```
```{image} ../images/web/<name>-dark.webp
:alt: What the picture shows
:class: only-dark
```
Write the same alt text on both, and translate it in the page’s French catalogue.