feat: enhance NodeCG runtime management and packaging

- Update .gitignore and .prettierignore to exclude additional cache and configuration files.
- Revise README.md for clarity on build processes and runtime behavior.
- Improve architecture documentation to reflect changes in startup flow and module responsibilities.
- Modify troubleshooting guide to address common runtime issues and installation steps.
- Enhance ESLint configuration to ignore more directories.
- Update package.json scripts for better build and distribution processes.
- Introduce build-scoreko-bundle.mjs for building the Scoreko bundle.
- Implement prepare-nodecg-runtime.mjs for managing NodeCG runtime installation and updates.
- Add runtime-provisioner.ts to handle user-specific NodeCG runtime provisioning.
- Create tests for runtime provisioning to ensure correct behavior.
- Refactor process-manager.ts and main.ts to integrate new runtime management logic.
This commit is contained in:
2026-05-09 17:45:36 +02:00
parent b10b8adb98
commit 41e4e91c4b
16 changed files with 737 additions and 100 deletions
+6 -4
View File
@@ -3,14 +3,16 @@
## Startup flow
1. `src/main/main.ts` loads `appConfig` from `config/runtime-config.ts`.
2. Creates windows (`windows/window-factory.ts`).
3. Starts NodeCG with `nodecg/process-manager.ts`.
4. Waits for HTTP readiness and shows loading -> main dashboard.
5. On shutdown, runs a single graceful-stop flow to avoid orphan processes.
2. Copies the packaged NodeCG runtime from app resources to user data when needed (`nodecg/runtime-provisioner.ts`).
3. Creates windows (`windows/window-factory.ts`).
4. Starts NodeCG with `nodecg/process-manager.ts`.
5. Waits for HTTP readiness and shows loading -> main dashboard.
6. On shutdown, runs a single graceful-stop flow to avoid orphan processes.
## Main modules
- `config/runtime-config.ts`: read/validate env vars.
- `nodecg/runtime-provisioner.ts`: install/refresh the managed runtime in the writable user data folder.
- `nodecg/process-manager.ts`: start, readiness, and stop for NodeCG; install/permission/port validation.
- `windows/window-factory.ts`: window creation and navigation policy.
- `windows/navigation-security.ts`: internal navigation allowlist and safe external schemes.
+12 -7
View File
@@ -1,14 +1,19 @@
# Troubleshooting
## `NodeCG folder does not exist`
## `The packaged NodeCG runtime is incomplete`
- Verify `lib/nodecg` exists.
- Make sure the project contains a full NodeCG installation.
- Run `npm run prepare:runtime` from `scoreko-electron-dev`.
- If the parent bundle is not installed yet, run `pnpm install` from the repository root first.
## `NodeCG is present but internal dependencies are missing`
- Recreate the runtime with `npm run prepare:runtime`.
- If native SQLite errors appear during launch, run `npm run rebuild:native` before packaging.
## `No read/write permissions on NodeCG`
- Adjust permissions on `lib/nodecg` for the user running Electron.
- On Linux/macOS: `chmod -R u+rw lib/nodecg` (according to your local policy).
- Installed builds run NodeCG from the user's app data folder, so this usually means the local development copy is locked.
- Close any running Scoreko/NodeCG process and run `npm run start` again.
## `Port <PORT> is already in use`
@@ -17,9 +22,9 @@
## `Timeout while waiting for NodeCG`
- Check NodeCG logs in standard output.
- Check the Electron/NodeCG output in the terminal.
- Increase `NODECG_STARTUP_TIMEOUT_MS` if the environment is slow.
- Verify NodeCG dependencies (`cd lib/nodecg && npm install`).
- Recreate the runtime with `npm run prepare:runtime` if the bundle changed.
## macOS build fails because of icon