✨ Contributing
Local development

Local development

Thanks for your interest! In this page, you find the instructions to set up tuono on your local environment!

Setup

Fork and clone repository

After forking the repo on GitHub:

git clone https://github.com/<your-name-here>/tuono
cd tuono

For the next steps, you can either set up the environment directly on your computer or use a ready-to-use Docker image (go to the Docker setup part).

Local setup

Rust tool chain

Install the Rust programming language tool chain (rust and cargo). Follows instructions in the official docs

Node.js — runtime

Install Node.js. You can follow the instructions from the Node official site

💡 This project has a .nvmrc file to specify the node version used in development.

Consider to use nvm so you can run

nvm use

to simply pick up the correct version!

Node.js — package manager

We use pnpm as Node.js package manager.

You can see which version of yarn we use by checking the packageManager field in the root package.json.

Pre-flight checks

To check that everything is working properly, run:

pnpm run check-all
cargo build

Docker setup

Introduction

Docker takes care of configuring the development environment, so you don’t need to worry about installing specific versions of packages like Node.js or pnpm. The Docker image handles this for you! Using Docker, the only operations you’ll need to manage on your host machine are related to git. (don't use pnpm, cargo, ... from your host machine) Some IDEs (such as vscode with the Dev Containers extension) allow you to connect directly to the Docker container.

Before proceeding with this guide, make sure that the node_modules and target directories are either absent or empty in the subprojects of Tuono from your host machine where you want to contribute. This ensures a clean and consistent environment when using Docker.

Build the Tuono's Docker Container

First, ensure Docker is installed on your machine by following the instructions on the Docker official site.

Once Docker is installed, use the following command to build the image into a container named tuono-source-container:

# Note: Execute this command in the project root
docker compose -f docker/compose.yml up --build -d

To verify that everything is working as expected, run the following command:

docker images && docker ps -a --size

Or on Windows:

docker images; docker ps -a --size

You should see the image named tuono-source-image and the container tuono-source-container. The container's status should be "up".

Use the following command to connect to the container:

docker exec -it tuono-source-container /bin/bash

Tuono development

  1. Start tuono frontend build using

    pnpm run dev
  2. In another terminal run

    cargo build

    To automatically rebuild crates on code change, consider using cargo-watch crate

    cargo watch -x build -w crates/
  3. You can now use the binary inside /target/debug/tuono in another folder on your local machine

    Consider adding an alias to your shell setup file

    alias t="/path-to-repo/target/debug/tuono"

Documentation development

  1. Change the current working directory to the documentation folder:

    cd apps/documentation
  2. Run

    tuono dev
  3. Open the localhost URL.

On the documentation remember that tuono npm package is installed from the registry and it is not linked to the repository.

Validate your changes

The following checks are all run on pull requests automatically.

You can also perform them locally.

Rust

Ensure that all code follows the style guidelines:

cargo fmt

Check that no linting errors/warnings are present:

cargo clippy -- -D warnings

Tests:

cargo test

Typescript

TypeScript checks are composed of the following:

  • build
  • format
  • lint
  • typecheck
  • test

You can run them singularly using pnpm run [CHECK] or by using the check-all script:

pnpm run check-all

E2E Tests

To execute end-to-end tests, we are using playwright. To install the required browsers, run:

pnpm exec playwright install

Then, you can run the tests with:

pnpm run test:e2e
Edit page