Files

66 lines
2.7 KiB
Markdown

# Scoreko Desktop
This is the Windows desktop wrapper for Scoreko. It bundles Electron, NodeCG, and our custom `scoreko-dev` bundle into a single standalone executable. Users just double-click the installer and everything works—no Node.js, pnpm, or command line required.
## Local Development
If you're working on the app locally, start by installing dependencies at the repository root:
```powershell
pnpm install
```
Then, move into the wrapper folder:
```powershell
cd scoreko-electron-dev
npm install
```
### Useful Commands
- `npm run start`: Builds the bundle and launches Electron locally for testing.
- `npm run dist:win`: Packages everything and creates the `.exe` Windows installer in the `release/` folder.
- `npm run prepare:runtime`: Extracts a fresh NodeCG runtime from the parent bundle (useful if you changed dependencies).
- `npm run rebuild:native`: Rebuilds native Node modules (like SQLite) specifically for Electron's V8 engine.
- `npm run doctor`: Runs a quick sanity check to verify your local configuration and port availability.
## How it works under the hood
When you build the installer, the script automatically compiles the main `scoreko-dev` bundle, provisions a lightweight NodeCG runtime in `lib/nodecg`, and packages it as an external asset alongside the Electron app.
When a user runs Scoreko for the first time, the app copies this NodeCG runtime directly into their local AppData folder. This is a deliberate choice: it ensures that databases, configs, and logs remain fully writable, even if the user installed the app in restricted directories like `Program Files`.
## Auto-Updates via Gitea
Scoreko supports seamless, opt-in updates through your Gitea instance.
Before building your production installer, check `static/updates.json`:
```json
{
"enabled": true,
"apiUrl": "http://gitea.local/api/v1/repos/OWNER/REPO/releases/latest",
"releasePageUrl": "http://gitea.local/OWNER/REPO/releases",
"assetPattern": "Scoreko-setup-.*\\.exe$"
}
```
**To ship an update:**
1. Bump the version in `package.json`.
2. Run `npm run dist:win` to generate the new installer.
3. Create a new release tag in Gitea (e.g., `v0.2.0`) and attach the `.exe`.
4. The app will detect the new version, notify the user, and handle the installation safely.
## Environment Configuration
The app ships with sensible defaults that match our development bundle:
- `NODECG_BUNDLE_NAME=scoreko-dev`
- `NODECG_PORT=9090`
- `SCOREKO_DASHBOARD_ROUTE=dashboard/scoreko-dev/main.html?standalone=true`
- `SCOREKO_UPDATES_ENABLED=true`
- `SCOREKO_UPDATE_ASSET_PATTERN=Scoreko-setup-.*\.exe$`
You only need to mess with `.env.example` if you want to override these values locally while testing.