Architecture Overview - planetarium/9c-launcher GitHub Wiki

It goes without saying that this project has some deviations from general SPA applications. This documentation aims to inform the basic guidance about the architecture of the 9c-launcher for quickly starting hacking for your needs.

The JavaScript build process

This is a lengthy explanation of webpack.config.js. Check the source code to ensure the behaviour matches your expectations.

TBD

scripts

This is the part where most of the scripts for building 9c-launcher into the package are suitable for distribution to its users. The process is not precisely documented but you can take some hints from .circleci/config.yml, which is used for actual releases.

src/main

The file inside here is meant to be run inside the Electron main process.

  • src/main/exceptions - Usually custom errors for snapshot and update. There's an open issue for merging this into src/errors: #1758.
  • src/main/headless - Abstractions for communicating with Remote Headless (RPC Server), It originally designed to use with NineChronicles.Headless, so It mimics some of it's behavior, need to be fixed.
  • src/main/resources - Game icons.
  • src/main/update - Update (Game, and launcher itself) related logic, including requirements and APV check.
  • src/main/main.ts - Handles most of the IPC, headless connection, and the application itself.

src/renderer

This directory is where most of the UI code resides.

  • src/renderer/components - Some components designed to be reusable across the application.
  • src/renderer/components/core - The components to draw the basic parts of the application.
  • src/renderer/components/ui - Basic UI elements to be used across the application and other components.
  • src/renderer/i18n - UI internationalization and localization related code, mostly rely on @transifex.
  • src/renderer/stores - MobX-based global state stores related to account and key signing, game execution, and NCG transfer.
  • src/renderer/machines - XState-based machines storing some of the important lifecycles of the application.
  • src/renderer/resources - Images.
  • src/renderer/utils - A black-hole containing some frequently used codes, usually in form of React hooks.
  • src/renderer/views - You can think of them as pages, except those named as overlays.
  • src/renderer/ipcTokens.ts - A file containing IPC event names. It is meant to be used across the processes.