Convert to use typescript, implement eslint

This commit is contained in:
2026-06-09 02:46:55 -06:00
parent d39e202de2
commit d40be3a919
13 changed files with 1551 additions and 187 deletions

View File

@@ -18,7 +18,7 @@ cd corsair-lcd-control
npm install
```
`postinstall` automatically rebuilds native modules for Electron using `@electron/rebuild`.
`postinstall` rebuilds native USB modules for Electron.
## Development
@@ -26,13 +26,15 @@ npm install
npm start
```
Compiles TypeScript to `build/`, then launches Electron with the compiled output.
## Build
```bash
npm run build
```
Produces platform-specific packages:
Compiles TypeScript, then produces platform-specific packages via electron-builder:
| Platform | Format |
|----------|--------|
@@ -40,6 +42,14 @@ Produces platform-specific packages:
| macOS | `.dmg` |
| Windows | `.exe` (NSIS) |
## Lint
```bash
npm run lint
```
Runs ESLint with `typescript-eslint` (`recommendedTypeChecked`) across all `src/` TypeScript files.
## Rebuild Native Modules
If native modules fail to load after a Node.js or Electron upgrade:
@@ -48,9 +58,26 @@ If native modules fail to load after a Node.js or Electron upgrade:
npm run rebuild
```
## Project Structure
```
├── src/
│ ├── main.ts # Electron main process
│ ├── preload.ts # Context bridge for IPC
│ ├── renderer.ts # Renderer UI logic
│ ├── index.html # Main window HTML
│ └── styles.css # Dark theme styles
├── assets/
│ └── icon.png # System tray icon
├── build/ # Compiled JS output (gitignored)
├── tsconfig.json # TypeScript config
├── eslint.config.js # ESLint config
└── package.json
```
## Capabilities
- **USB** — `usb` module enumerates and connects to devices
- **USB** — enumerates and connects to devices via `usb`
- **System Tray** — background process with context menu (Show/Hide/Quit)
- **Preferences** — persisted via `electron-store` (JSON)
- **File Pickers** — native OS dialogs via Electron's `dialog` API