Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyko committed Feb 2, 2024
1 parent 120e716 commit ea22d2c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-toml
- id: check-yaml
- id: pretty-format-json
args: ["--indent=4", "--autofix", "--no-sort-keys"]
# - id: check-added-large-files

- repo: local
hooks:
- id: format
name: format
description: Format files with rustfmt.
entry: makers fmt
language: system
types: [rust]
pass_filenames: false
- id: lint
name: lint
description: Lint files with Clippy.
entry: makers lint
language: system
types: [rust]
pass_filenames: false
- id: check
name: check
description: Check files with Cargo Check
entry: cargo check
language: system
types: [rust]
pass_filenames: false
1 change: 1 addition & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ script = '''
[tasks.dev]
command = "cargo"
args = ["run"]
env_files = ["./.env"]
watch = true

[tasks.lint]
Expand Down
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# jsbm.dev

> Benchmark storage and redirecting Cloudflare Worker for [JSBenchmark.com](https://jsbenchmark.com)
> Benchmark storage and redirecting API for [JSBenchmark.com](https://jsbenchmark.com)
## API

Expand Down Expand Up @@ -79,32 +79,25 @@ interface ReplState {

To get up-and-running in development, do the following:

1. Setup Wrangler
1. Clone `.env`

I use [`Volta`](https://volta.sh) but `npm i -g` works just as well.
The example file is `.env.example`.

```bash
$ volta install wrangler # or
$ npm i -g wrangler
```sh
$ cp .env.example .env
```

Then, run `wrangler login` and follow the instructions.

1. Clone `.dev.vars`
2. Start postgres

The example file is prefixed with an underscore.
Run `docker compose up --wait` to start postgres

```sh
$ cp _.dev.vars .dev.vars
```
3. Run migrations

1. Start postgres (and pgbouncer)
Install the [`sqlx-cli`]() then run `sqlx migrate run`.

Run `docker compose up --wait` to start postgres and pgbouncer.
Pgbouncer is used to pool connections to the database, which is required for serverless.
The migrations are ran automatically.
4. Start the server

Neon, the database provider this project recommends in production, has a native pooling option, so this is only required for development.
`makers dev`

## Deployment

Expand Down

0 comments on commit ea22d2c

Please sign in to comment.