React / Electron Desktop app for Sphinx
- Clone the repo.
- Install dependencies.
`npm install`
npm run web
npm run electron
- Each pull request should include documentation:
- purpose of changes
- any libraries added & if they need linking
- Desktop dev:
npm run install-app-deps
npm run web
- if you are developing on a windows machine, change the
electron
script inpackage.json
to:set ELECTRON_DEV_URL=http://localhost:3000 && electron .
- in another terminal
npm run electron
If you hit an error saying electron-deeplink: unable to lock instance
, you can comment out the deeplink stuff in public/electronjs/main.js
lines 35-45
Desktop build
-
Windows
- must build on Windows machine
- npm run build
- package.json postinstall script:
electron-builder install-app-deps --platform=win32
- remove "realm" from package.json dependencies (only needed for RN)
- yarn && yarn dist:win (or npm i && npm run dist:win)
-
Linux:
- npm run build
- on mac? use docker image from here https://www.electron.build/multi-platform-build
electronuserland/builder
- package.json postinstall script:
electron-builder install-app-deps --platform=linux
- remove "realm" from package.json dependencies (only needed for RN)
- yarn && yarn dist:linux
react:
- 100% typescript
- 100% function components and hooks
- Layouts in flexbox
- Self-contained, minimal components (each <150 LOC)
State management:
- "useStores" to get state in each component (few props)
- App state managed by mobx observables (except state local to a single component)
- All calls to backend managed in mobx actions (src/store). Each action should catch errors, but not throw any error
- Persist state with mobx-persist (dont directly use AsyncStorage)
- Incoming websocket messages managed from one interface (src/store/websocketHandlers.ts)