Files
metrics/.github/readme/partials/documentation/setup/local.md
2022-02-07 20:59:16 -05:00

46 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 🔧 Local setup for development (~20 min)
## 0 Prepare your machine
A machine with a recent version of [NodeJS](https://nodejs.org) is required (see used version in [Dockerfile](/Dockerfile#L1-L2)).
## 1 Clone repository and install dependencies
Run the following command to clone this repository and install dependencies.
```shell
git clone https://github.com/lowlighter/metrics.git
cd metrics/
npm install
cp settings.example.json settings.json
```
## 2 Setup and configure *metrics*
Follow [🏗️ Deploying a web instance (~20 min)](/.github/readme/partials/documentation/setup/web.md) guide except docker-related sections.
Once read, start local instance using the following command:
```shell
npm start
```
## 3 Start hacking!
Connect to your web server using `http://localhost:{port}` and start hacking!
For quick testing, it is advised to directly craft URLs, rather than using the web interface.
*Example: test a new plugin*
```shell
https://localhost:{port}/username?base=0&newplugin=1&newplugin.option1=hello&newplugin.option2=world)
```
## *️⃣ Testing changes
Testing is done through [jest](https://github.com/facebook/jest) framework.
To avoid consuming APIs requests and causing additional charges on external services, data are [mocked](/tests/mocks/index.mjs) using [JavaScript Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) and [Faker.js](https://github.com/faker-js/faker) with randomly generated data.
Since tests are pretty long to run, it is advised to just let GitHub Actions do the testing.