03 Development - Cowoding-Jams/Jambo GitHub Wiki
Some of the core concepts of our code for developers planing to build upon or in general work with our codebase.
Make yourself familiar with our Code of Conduct, Contribution Guidlines and our Security Policy!
Currently there are 4 scripts definied for this project.
You can run them by using npm run [script name]
-
prettify
to let eslint and prettier look over the code and enforce the specified beauty standards -
build
to compile the TypeScript to JavaScript code with the tsconfig.json -
run
to run the main script (start.js
) -
start
as a shorthand forbuild
and thenrun
-
prepare
to enable husky for pre-commit prettify
We're using winston as logger to log all the important infos instead of the typical console.log("")
.
This gives us a lot more clearity and order.
To use it just import the logger from the logger.ts
somewhere in the src
folder and use logger.debug("xy")
(or with any other loglevel like logger.warn()
or logger.error()
).
You can set the level of detail you want in the src/config.ts
file to be for example error
, warn
, info
or debug
(in order of importance). All the other levels can be found here.
The error messages will also be stored in the logs
folder.
This explains how you run a version of your code with docker. For example on a Raspberry Pi if you have to do some long time testing and don't want to let your work station run 24/7. For quick tests just use npm run start
.
Prerequisites: You have docker
and docker-compose
installed on your system and access to it.
Note: You may have to use docker compose
in the commands instead of docker-compose
.
Steps (things in brackets are the jambo examples you have to replace):
- Clone your repository in any directory, change into it and create the data directory.
git clone [https://github.com/Cowoding-Jams/Jambo.git] && cd [Jambo] && mkdir data
- You can then optionally switch to another branch.
git checkout master
- Build the container and start it.
docker-compose build && docker-compose up -d
- In the directory pull the latest code.
git pull
- Rebuild and start everything.
docker compose build && docker compose up -d
You can view its logs with docker-compose logs
.