blob: 991d2e5a31f795356c0792ac61bb7c0197dd23dd (
plain) (
blame)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# TyperPunk
A modern typing test in your terminal (CLI) and in the browser (Web).
## Quick Start
- **CLI (Terminal UI)**
```bash
# Clone and enter
git clone https://github.com/yourusername/typerpunk.git
cd typerpunk
# Install for CLI (builds TUI and optionally merges dataset packs)
./install.sh
# Run CLI
cargo run --package typerpunk-tui
```
- **Web**
```bash
# From repo root: builds WASM and starts the static dev server
./web/launch.sh
```
Opens http://localhost:4173
## Dataset (shared by CLI 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
node scripts/merge_packs.js
```
- **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`.
## CLI Keys
- Start: Enter
- Quit: Esc
- Change category: Left/Right
- Delete word: Ctrl+Backspace / Alt+Backspace / Ctrl+H / Ctrl+W
## Scripts Scope
- `install.sh`: CLI-focused (Rust toolchain, dataset merge via Node, builds TUI)
- `web/launch.sh`: Web dev workflow (WASM build + zero-dependency static server)
No npm packages are used anywhere in this repo. Node.js is used only as a
runtime for small built-in-module-only scripts (`scripts/merge_packs.js`,
`web/serve.mjs`); nothing is ever installed from the npm registry.
## Repo Layout
```
typerpunk/
├── Cargo.toml # Workspace configuration
├── crates/
│ ├── core/ # Shared core functionality
│ └── tui/ # Terminal UI implementation
├── data/
│ └── packs/ # Offline dataset packs
├── web/ # Web app (plain HTML/CSS/JS, no build step)
│ ├── src/
│ ├── index.html
│ └── serve.mjs
├── scripts/
│ └── merge_packs.js # Merge packs into texts.json
└── README.md
```
## License
MIT
|