aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 52d01c4345b2f110cfd53c1ac316cf8768e194b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# TyperPunk

A modern typing game for terminal (TUI) and in the browser (Web).

## Quick Start

- **TUI (Terminal UI)**
  ```bash
  # Clone and enter
  git clone https://github.com/srdusr/typerpunk.git
  cd typerpunk

  # Install for TUI (builds TUI and optionally merges dataset packs)
  ./install.sh

  # Run TUI
  cargo run --package typerpunk-tui
  ```

- **Web**
  ```bash
  # From repo root: builds WASM and starts Vite
  ./web/launch.sh
  ```
  Opens http://localhost:3000

## Dataset (shared by TUI and Web)

- **Offline (recommended)**
  - Add texts to `data/packs/*.json` with fields:
    ```json
    { "category": "programming", "content": "80–400 chars…", "attribution": "Author" }
    ```
  - Merge packs into the shared `texts.json` at repo root:
    ```bash
    npm install
    npm run merge-packs
    ```

- **Online (optional, web only)**
  - Host a `texts.json` and set a URL in the page (e.g., `web/index.html`):
    ```html
    <script>window.TYPERPUNK_TEXTS_URL = "https://your.cdn/path/to/texts.json";</script>
    ```
  - The web app uses the online dataset if reachable; otherwise it falls back to the bundled file.

Notes:
- `web/launch.sh` copies the root `texts.json` into `web/src/data/texts.json` for local dev.
- A small fallback dataset is kept in `web/src/data/texts.json`.

## TUI Keys

- Start: Enter
- Quit: Esc
- Change category: Left/Right
- Delete word: Ctrl+Backspace / Alt+Backspace / Ctrl+H / Ctrl+W

## Scripts Scope

- `install.sh`: TUI-focused (Rust toolchain, dataset merge if npm is present, builds TUI)
- `web/launch.sh`: Web dev workflow (WASM build + Vite dev server)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.