mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 05:32:06 +00:00
1.6 KiB
1.6 KiB
Main process architecture
Startup flow
src/main/main.tsloadsappConfigfromconfig/runtime-config.ts.- Installs or refreshes the packaged NodeCG runtime in user data when needed (
nodecg/runtime-provisioner.ts). - Creates windows (
windows/window-factory.ts). - In packaged builds, relaunches once after a fresh runtime install so NodeCG starts from a settled user-data runtime.
- Starts NodeCG with
nodecg/process-manager.ts. - Waits for HTTP readiness and shows loading -> main dashboard.
- Checks the configured Gitea latest-release endpoint for optional updates.
- 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 and report whether it changed.nodecg/process-manager.ts: start, readiness, and stop for NodeCG; install/permission/port validation.updates/update-manager.ts: optional Gitea release checks, installer download, and user-controlled install.updates/update-utils.ts: release version comparison and installer asset selection.windows/window-factory.ts: window creation and navigation policy.windows/navigation-security.ts: internal navigation allowlist and safe external schemes.errors/error-presenter.ts: fatal error presentation.errors/logger.ts: structured logging (info/warn/error/debug).
Principles
- Mechanical refactors first.
- Incremental hardening with conservative fallback.
- Automated validation via
typecheck,build,test,doctor,lint.