Development Environment Setup
Global System Installations
Before you can start developing with votura, you need to install some global dependencies. We need:
For the installation we refer to the official documentation of the tools.
Please run the following commands to check if you have installed the tools correctly:
git -v
node -v
npm -v
Starting with the votura repository
Now we can clone the votura repository to your preferred working directory:
git clone https://github.com/SE-UUlm/votura.git
Now you should be already ready to start developing with votura.
Repository Structure
We are using one monorepo (with the help of turborepo) for all parts of the votura project. Here is nice overview of what is the idea behind.
The following image gives a brief overview of the structure of the repository:
The votura repository is a npm project (sometimes also called as workspace).
In the apps
folder you can find all the applications of votura that can run independently, like the documentation,
frontend or backend server.
In the packages
folder you can find all the shared packages that are used in the applications, like the votura-crypto
package or the typescript and eslint configuration.
Now you can run in the root folder the following command to install all dependencies of the repository:
npm install
Turborepo
All these sub-projects are independent npm projects, but they have some dependencies and configuration to each other. You can navigate to the sub-projects and test, build or run them on their own. But the main advantage of turborepo is that you can run all the commands in the root folder, and you can run, test or build all the sub-projects at once.
Installing Workspace-Scoped Dependencies in a Turborepo Monorepo
In a monorepo using Turborepo, dependencies can be shared across packages using workspace
protocols defined in package.json
. This also allows you to install internal packages as dependencies using workspace
scoping.
To add a workspace-scoped dependency to an app, run:
npm install <package-name> -w <workspace-name>
Building the project
Try this in the root folder:
turbo build
As you can see this can take a while, because it builds all the sub-projects. But now you can try this a second time:
turbo build
As you see, the second time it is much faster. This is because turborepo caches the build results and only builds the sub-projects that have changed.
If you only want to build a specific sub-project from the root folder, you can do this with the following command:
turbo docs#build
The same applies to all other following commands.
Turborepo automatically detects the dependencies between the sub-projects and builds them in the correct order. You can check the order for a specific task in the generated SVG by typing:
npx turbo run build --graph=graph.svg
Typecheck votura
turbo typecheck
Linting votura
Teamscale
We are using a Teamscale server to run linting and static analysis on the votura codebase. You can connect your IDE (e.g. with the VSC Extension) to the Teamscale server to get real-time feedback on your code.
- Please check all findings that Teamscale reports in our PR in GitHub and fix them.
- If you think there is a rule activated that is not useful for the votura project at all, please bring this discussion to the next technical meeting, so that we can discuss it with the whole team and can reconfigure Teamscale if necessary.
- If you think the complaining rule is useful in general, but not for your specific case, you can add tolerate this finding with a comment in the Teamscale UI.
ESLint
npm run lint
Format votura
turbo format
Start all development servers
turbo start