From aebe1cce89bcd10787541189962df093f8bd531a Mon Sep 17 00:00:00 2001 From: aeberhardt <alexandre.eberhardt@savoirfairelinux.com> Date: Mon, 2 Dec 2024 15:47:44 -0500 Subject: [PATCH] Doc: Fix and complete the README.md Add undocumented routes, fix instalation and clean md format Change-Id: I79eb0518995cf27553eb810955b3b8b73341aa2b --- README.md | 111 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 88 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 66fd00c..d3539e3 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,81 @@ # Plugins Store The idea is to provide the user a quick way to discover and install plugins via the plugin store. +This server run to serve plugins.jami.net, the API is the same. ## Prerequisites + npm + Node.js 18.16+ + Docker ++ ts-node ## Installation of Node.js 18.16 -how to install Node.js 18.16 with nvm - -`$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash` +how to install nvm -`$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash` +```bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash +``` -`$ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"\n[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm` +```bash +wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash +``` -`$ command -v nvm` +```bash +export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" +``` +```bash +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +``` +verify with +```bash +command -v nvm +``` how to install Node.js 18.16 with nvm -`$ nvm install 18.16.0` +```bash +nvm install 18.16.0 +``` + +# Installation of ts-node + +```bash +sudo apt install ts-node +``` + +# installation of dotenv and typedi + +```bash +npm install dotenv typedi +``` # Scripts run the server -`$ npm start` +```bash +npm start +``` lint -`$ npm run lint` +```bash +npm run lint +``` fix the linting -`$ npm run fix` +```bash +npm run fix +``` run tests and see code coverage -`$ npm test` +```bash +npm test +``` ## Add plugin in development environnement @@ -54,16 +89,35 @@ python3 ./build.py --plugin <path-to-plugin> --arch <architecture-target> ### Get all plugins -`$ curl -X GET http://localhost:3000/?arch=desktop` - +```bash +curl -X GET http://localhost:3000/?arch=x86_64-linux-gnu +``` ### Get a plugin's details -`$ curl -X GET http://localhost:3000/details/AudioFilter` - +```bash +curl -X GET http://localhost:3000/details/GreenScreen?arch=AnyArgWorks # Even an invalid arch works but you need to add the arch parameter to get results +``` ### Download a plugin by its id -`$ curl -X GET http://localhost:3000/download/WaterMark.jpl` +```bash +curl -X GET http://localhost:3000/download/x86_64-linux-gnu/GreenScreen --output ./GreenScreen.jpl +``` + +### Get a plugin's version + +```bash +curl -X GET http://localhost:3000/versions/GreenScreen?arch=x86_64-linux-gnu +``` +### Get a plugin's icon + +```bash +curl -X GET http://localhost:3000/icons/GreenScreen?arch=x86_64-linux-gnu +``` +### Get a plugin's background +```bash +curl -X GET http://localhost:3000/backgrounds/GreenScreen?arch=x86_64-linux-gnu +``` ## Contributing We have a set of ESLint rules that define clear syntax rules (/.eslintrc.json). You will need the following tools: @@ -83,11 +137,14 @@ To install Docker please read this manual: https://docs.docker.com/engine/instal Build a docker image: -`docker build -t server-image --target server .` - +```bash +docker build -t server-image --target server . +``` Run the docker container: -`docker run -p 3000:3000 -ti server-image` +```bash +docker run -p 3000:3000 -ti server-image +``` To stop the container do CTRL + C in the terminal. @@ -96,18 +153,26 @@ To stop the container do CTRL + C in the terminal. Build the test image: -`docker build -t test-image --target test .` +```bash +docker build -t test-image --target test . +``` Run the test image: -`docker run test-image` +```bash +docker run test-image +``` ### To check if the code has been linted correctly in the docker container Build the lint image: -`docker build -t lint-image --target lint .` +```bash +docker build -t lint-image --target lint . +``` Run the lint image: -`docker run lint-image` +```bash +docker run lint-image +``` -- GitLab