Frontend
NOTE
For all the listed commands below, it is assumed that they are executed in the root directory of the checked out frontend repo
Generating types
Simply run the provided script either locally (if you have npx installed and feel comfortable installing an npm package locally) or in a docker container.
The script (./generate-types.sh) can be run without args (it will download the type defs from GitHub) or with an argument (that argument being the URL of a running instance of the backend)
Linter and type checker runs on PRs
To keep the code style consistent, on every pull request, a GitHub action will run formatting of your code if you haven't done so already. It will also run a type check and NO PR WITH FAILING CHECKS will be merged (into main).
Running linter and type checker
You may run the linter and type-checker using the shipped run-lint.sh script.
If you also occasionally use the dev-container-node image or have node and npm installed locally, you may run the following commands in the shell:
npm run type-check && npm run lint-fixDev environment setup
You may choose between using the prebuilt docker images I provide for everything (including a local backend that will be required in the future) via the commands below, or follow the instructions in the next section to develop using the dev-container-node or locally installed node.js.
The recommended way of running the backend (you don't need to worry about deps or anything) is to run one of the following commands in the root directory of this repo:
docker compose -f compose.backendless.yml up -d # If you want to run without backend (that may at some point stop being viable)
docker compose up -d # If you want to run with a backendRunning with locally installed tools
This section also applies if you use the dev-container-node instead of the compose file.
Install the dependencies using
npm ithen start the development server of vite using
npm run devFor spinning up the backend without docker, see the backend repo.
Running with dev-container-node
Run the following command with docker installed to get a container with the same dependencies installed as runner, but with a shell instead:
docker run -it -p 8081:8081 --name prototype -v .:/mnt ghcr.io/janishutz/dev-container-nodeTo launch the container again later, you can use
docker start -i prototypeor to start the container and removing it whenever you exit it:
docker run -it -p 8081:8081 --rm -v .:/mnt ghcr.io/janishutz/dev-container-nodePlease note that you can instead of doing this use
docker exec -it frontend bashwhen you used the compose file to achieve mostly the same results. The only difference being that the frontend has to be up when you use this command.
Details
The following environment variables can be set during development:
VITE_BACKENDLESS=true # (or false) to disable login checks
VITE_BACKEND_URL=<url> # To set the backend URL to anything other than http://localhost:8080