Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
YummYume committed Mar 19, 2024
1 parent 2be2509 commit a023866
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
How to contribute to the project?
There are 2 ways of contributing: reporting a bug or proposing a feature, and making changes to the code.

## Content

- [Contributing to the project](#contributing-to-the-project)
- [Content](#content)
- [How to contribute by reporting a bug/proposing a feature?](#how-to-contribute-by-reporting-a-bugproposing-a-feature)
- [How to contribute to the code?](#how-to-contribute-to-the-code)
- [Branches](#branches)
Expand Down Expand Up @@ -56,7 +59,7 @@ Everything you need to know to use this project and contribute to it is written
- Go to [http://local.ranky-list.com](http://local.ranky-list.com) to access the app and [http://local.pocketbase.ranky-list.com](http://local.pocketbase.ranky-list.com/_/#) to access the PocketBase admin panel.
- From there, you can add your own code and tests in the appropriate folders.

> **Warning**
> [!WARNING]
> Docker is required. We do not recommend running this project without it.
### What do I need to check before making a PR?
Expand Down Expand Up @@ -85,7 +88,7 @@ For example, add `127.0.0.1 local.ranky-list.com` to be able to access the app o
| `mailcatcher` | SMTP service used to catch emails during development. | | [http://local.mailcatcher.ranky-list.com](http://local.mailcatcher.ranky-list.com) |
| `pocketbase` | Service running PocketBase, including the SQLite DB and API. Also serves as a Go backend. | | [http://local.pocketbase.ranky-list.com](http://local.pocketbase.ranky-list.com/_/#) |

> **Note**
> [!NOTE]
> The URLs are both prefixed with `local.` and suffixed with `.ranky-list.com` to avoid conflicts with real domains, while still being considered valid domains for OAuth providers.
#### Hosts file
Expand Down Expand Up @@ -151,7 +154,7 @@ Assuming you did not change the credentials in the root `.env` file :
- User : `[email protected]`,
- Password : `root`.

> **Note**
> [!NOTE]
> Migrations are applied automatically and the database is kept on your host machine, so you will not lose data even after deleting the container.
### IDEs
Expand Down
5 changes: 4 additions & 1 deletion docs/E2E.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

This section concerns E2E testing in the app. E2E testing is done using [Playwright](https://playwright.dev/).

> **Note**
> [!NOTE]
> Playwright is not run using Docker, unlike the rest of the app. You will need to have at least Bun and the Playwright browsers installed on your machine. A Make command will maybe be added in the future to run the tests from a temporary container.
## Content

- [E2E Testing](#e2e-testing)
- [Content](#content)
- [How to run E2E tests](#how-to-run-e2e-tests)

## How to run E2E tests
Expand Down
3 changes: 3 additions & 0 deletions docs/EMAILS.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

Sending emails with PocketBase is very easy. However, to test emails during development, you have to make PocketBase aware of our `mailcatcher` service.

## Content

- [Emails](#emails)
- [Content](#content)
- [Testing emails in dev](#testing-emails-in-dev)
- [Creating custom emails](#creating-custom-emails)

Expand Down
16 changes: 9 additions & 7 deletions docs/FIXTURES.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

This section concerns fixtures for PocketBase. Fixtures are fake data generated to facilitate development.

## Content

- [Fixtures](#fixtures)
- [Content](#content)
- [How to load fixtures](#how-to-load-fixtures)
- [Env variables](#env-variables)
- [Commands](#commands)
Expand All @@ -14,7 +17,7 @@ This section concerns fixtures for PocketBase. Fixtures are fake data generated

## How to load fixtures

> **Warning**
> [!WARNING]
> Be aware that fixtures will delete all current records in your DB, which is why they aren't allowed in production.
First, make sure you have your env variables correctly set.
Expand All @@ -23,7 +26,7 @@ First, make sure you have your env variables correctly set.

Some of these variables are already set by default in the `.env` file, however, you can override them in a `.env.local` file (to set your own PocketBase password for example).

> **Note**
> [!NOTE]
> The correct `.env` file to use is located in the `svelte-kit` folder. The root `.env` file is used for Docker only.
| Variable | Description |
Expand All @@ -38,9 +41,8 @@ Some of these variables are already set by default in the `.env` file, however,

To load fixtures, run `bun run fixtures` in the `svelte-kit` container, or `make fixtures` outside the container.

> **Note**
> By default, the `bun run fixtures` command will ask you if you want to run fixtures and delete all current records.
> You can omit this prompt by adding `-f` to the command. The `make fixtures` command already does that.
> [!NOTE]
> By default, the `bun run fixtures` command will ask you if you want to run fixtures and delete all current records. You can omit this prompt by adding `-f` to the command. The `make fixtures` command already does that.
## How to create a fixture

Expand Down Expand Up @@ -153,7 +155,7 @@ export default {
With that, your fixture will be automatically loaded.
You can (and should) use a `FormData` instance containing all your fields instead of an object if you want to send files.

> **Warning**
> [!WARNING]
> Avoid using the `faker` instance to generate random data for key fields. This will make it difficult to reference these records during tests. Instead, create a `DATA` constant to hold the data you want to use for your fixtures. Keep `faker` for generating other unuseful data (like a random image url).
#### Inserting files
Expand Down Expand Up @@ -193,5 +195,5 @@ records[i] = await pb.collection('users').create<UsersResponse>(formData);

```

> **Note**
> [!NOTE]
> `FormData.append` only accepts `string` or `Blob` as value. For any other value, you can use `JSON.stringify`.
4 changes: 3 additions & 1 deletion playwright/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# TODO
# RankyList E2E tests

This is the E2E tests for RankyList, using Playwright. Read the [E2E guide](../docs/E2E.MD) for more information.
3 changes: 3 additions & 0 deletions pocketbase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RankyList API

This is the back-end API for RankyList, using PocketBase. Read the [contributing guide](../CONTRIBUTING.md) for more information.
2 changes: 1 addition & 1 deletion svelte-kit/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# RankyList App

This is the front app used used for RankyList, made with SvelteKit.
This is the front app used used for RankyList, made with SvelteKit. Read the [contributing guide](../CONTRIBUTING.md) for more information.

0 comments on commit a023866

Please sign in to comment.