Skip to content

Commit 982f3dc

Browse files
committed
migrate to typescript
1 parent ed42d5b commit 982f3dc

55 files changed

Lines changed: 3912 additions & 2862 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.oxfmtrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"semi": false,
4+
"singleQuote": true,
5+
"jsxSingleQuote": true,
6+
"experimentalSortImports": {
7+
"groups": [
8+
["side-effect"],
9+
["builtin"],
10+
["external", "type-external"],
11+
["internal", "type-internal"],
12+
["parent", "type-parent"],
13+
["sibling", "type-sibling"],
14+
["index", "type-index"]
15+
],
16+
"newlinesBetween": false
17+
}
18+
}

.vscode/settings.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"[markdown]": {
2+
"[markdown,mdx]": {
33
"editor.detectIndentation": true,
44
"editor.insertSpaces": false,
55
"editor.indentSize": "tabSize",
66
"editor.tabSize": 4
7-
}
7+
},
8+
"editor.defaultFormatter": "oxc.oxc-vscode",
9+
"editor.formatOnSave": true,
10+
"editor.formatOnSaveMode": "file"
811
}

CLAUDE.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
77
This is the **Talo documentation website**, built with Docusaurus. Talo is an open-source game backend that provides features like player management, event tracking, leaderboards, game saves, stats, and feedback for Godot and Unity games.
88

99
The documentation is organized into several main sections:
10+
1011
- **Unity**: Unity package documentation (`docs/unity/`)
1112
- **Godot**: Godot plugin documentation (`docs/godot/`)
1213
- **HTTP API**: REST API reference documentation (`docs/http/`)
@@ -17,24 +18,31 @@ The documentation is organized into several main sections:
1718
## Development Commands
1819

1920
**Start development server:**
21+
2022
```bash
2123
npm start
2224
```
25+
2326
This starts a local development server on port 3009 with live reload.
2427

2528
**Build for production:**
29+
2630
```bash
2731
npm run build
2832
```
33+
2934
Generates static content in the `build/` directory.
3035

3136
**Clear cache:**
37+
3238
```bash
3339
npm clear
3440
```
41+
3542
Clears the Docusaurus cache (useful when experiencing build issues).
3643

3744
**Serve production build locally:**
45+
3846
```bash
3947
npm run serve
4048
```
@@ -45,14 +53,13 @@ npm run serve
4553

4654
The HTTP API documentation uses a unique architecture that fetches live API route definitions from the Talo backend:
4755

48-
1. **`docusaurus.config.js`**: During build/start, fetches API route metadata from `https://api.trytalo.com/public/docs` (or `http://localhost:3000` in development) and stores it in `customFields.docs.services`
56+
1. **`docusaurus.config.ts`**: During build/start, fetches API route metadata from `https://api.trytalo.com/public/docs` (or `http://localhost:3000` in development) and stores it in `customFields.docs.services`
4957

5058
2. **Service Documentation Components** (`src/components/documentation/`):
51-
- `ServiceDocumentation.js`: React component that renders API routes from the fetched metadata as interactive documentation
52-
- `ServiceDocumentationWithTOC.js`: Variant with table of contents
53-
- `generateServiceTOC.js`: Generates table of contents from service routes
54-
- `useServiceDocs.js`: Hook to access service data from Docusaurus context
55-
- `Sample.js`: Renders code samples for API endpoints
59+
- `ServiceDocumentation.tsx`: React component that renders API routes from the fetched metadata as interactive documentation
60+
- `generateServiceTOC.ts`: Generates table of contents from service routes
61+
- `useServiceDocs.ts`: Hook to access service data from Docusaurus context
62+
- `Sample.tsx`: Renders code samples for API endpoints
5663

5764
3. **MDX Files** (`docs/http/*.mdx`): Use the `<ServiceDocumentation service='ServiceName' />` component to render live API docs. Examples: `event-api.mdx`, `game-channel-api.mdx`, etc.
5865

@@ -62,7 +69,7 @@ The benefit of this architecture is that API documentation automatically stays i
6269

6370
- **Markdown files** (`docs/**/*.md`): Standard documentation pages written in Markdown
6471
- **MDX files** (`docs/**/*.mdx`): Documentation pages that use React components (primarily for API docs)
65-
- **Sidebars** (`sidebars.js`): Uses Docusaurus auto-generated sidebars from the directory structure
72+
- **Sidebars** (`sidebars.ts`): Uses Docusaurus auto-generated sidebars from the directory structure
6673
- **Static assets** (`static/`): Images and other static files referenced in docs
6774

6875
### Node Version
@@ -72,6 +79,7 @@ This project requires **Node.js 20.x** (specified in `package.json` engines fiel
7279
## Documentation Conventions
7380

7481
- Use frontmatter for page metadata:
82+
7583
```yaml
7684
---
7785
sidebar_position: 1
@@ -81,9 +89,9 @@ This project requires **Node.js 20.x** (specified in `package.json` engines fiel
8189

8290
- Cross-reference other docs using relative paths: `/docs/unity/install`
8391

84-
- Include code samples in fenced code blocks with language identifiers (e.g., ```csharp, ```gdscript, ```bash)
92+
- Include code samples in fenced code blocks with language identifiers (e.g., `csharp, `gdscript, ```bash)
8593

86-
- The site supports C# and GDScript syntax highlighting via Prism (configured in `docusaurus.config.js`)
94+
- The site supports C# and GDScript syntax highlighting via Prism (configured in `docusaurus.config.ts`)
8795

8896
## Important Notes
8997

babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/godot/channels.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ var is_last_page := members_page.is_last_page
205205
```
206206

207207
You can provide the following filtering options:
208+
208209
- `page`: the current pagination index
209210
- `player_id`: find channel members with this player ID
210211
- `alias_id`: find a channel member with this ID
@@ -234,6 +235,7 @@ func _on_message_received(channel: TaloChannel, player_alias: TaloPlayerAlias, m
234235
### Listening for other signals
235236

236237
You can also listen for the following signals:
238+
237239
- `Talo.channels.player_joined`: Emitted when a player joins a channel. Returns the `TaloChannel` and the `TaloPlayerAlias` that joined.
238240

239241
- `Talo.channels.player_left`: Emitted when a player leaves a channel. Returns the `TaloChannel`, the `TaloPlayerAlias` that left and a `Talo.channels.ChannelLeavingReason`.

docs/godot/events.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Events are sent off in batches to prevent issues around rate limiting or using t
3838
## Meta props
3939

4040
Talo sends through some extra props with each event. These props are made up of the following metadata:
41+
4142
- The player's operating system
4243
- The version of the game
4344
- The window mode (fullscreen, fullscreen windowed, maximized window or windowed)

docs/godot/install.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ socket_url="wss://api.trytalo.com"
4747
```
4848

4949
You can also add the following section for logging:
50+
5051
```gdscript title="addons/talo/settings.cfg"
5152
...
5253

docs/godot/leaderboards.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ To create a leaderboard, head over to [the dashboard](https://dashboard.trytalo.
1414
Check out this blog post on [how to build quick & easy leaderboards in Godot](https://trytalo.com/blog/leaderboards-godot?utm_source=docs&utm_medium=tip) for a detailed walkthrough
1515
:::
1616

17-
1817
## Creating entries
1918

2019
<ScopeBadges scope='leaderboards' write />

docs/godot/player-authentication.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Once a player is registered, a session will automatically be created for them an
4444
To start a session, call the `Talo.player_auth.login()` function with the username and password the player provided.
4545

4646
The `login()` function returns a `Talo.player_auth.LoginResult` which maps to:
47+
4748
1. A successful login
4849
2. A successful login but the player must verify their details before creating the session
4950
3. An unsuccessful login attempt
@@ -142,7 +143,7 @@ if res != OK:
142143
TaloAuthError.ErrorCode.NEW_PASSWORD_MATCHES_CURRENT_PASSWORD:
143144
validation_label.text = "New password must be different from the current password"
144145
_:
145-
validation_label.text = Talo.player_auth.last_error.get_string()
146+
validation_label.text = Talo.player_auth.last_error.get_string()
146147
else:
147148
password_change_success.emit()
148149
```

docs/godot/player-presence.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var res := await Talo.player_presence.update_presence(online, custom_status)
4444

4545
This function returns a `TaloPlayerPresence` object.
4646

47-
## Subscribing to presence
47+
## Subscribing to presence
4848

4949
<ScopeBadges scope='playerPresence' read />
5050

0 commit comments

Comments
 (0)