electron-vite-react-template 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.claude/settings.local.json +15 -0
  2. package/.github/workflows/ci.yml +77 -0
  3. package/CONTRIBUTING.md +58 -0
  4. package/LICENSE +21 -0
  5. package/README.md +157 -0
  6. package/SECURITY.md +29 -0
  7. package/docs/PROJECT.md +249 -0
  8. package/electron.vite.config.ts +46 -0
  9. package/eslint.config.js +28 -0
  10. package/package.json +57 -0
  11. package/postcss.config.js +6 -0
  12. package/src/main/index.ts +110 -0
  13. package/src/preload/index.ts +33 -0
  14. package/src/renderer/env.d.ts +16 -0
  15. package/src/renderer/index.html +16 -0
  16. package/src/renderer/src/components/mode-toggle.tsx +31 -0
  17. package/src/renderer/src/components/theme-provider.tsx +140 -0
  18. package/src/renderer/src/components/ui/button.tsx +50 -0
  19. package/src/renderer/src/components/ui/dropdown-menu.tsx +188 -0
  20. package/src/renderer/src/components/use-theme.ts +12 -0
  21. package/src/renderer/src/hooks/use-sample.ts +7 -0
  22. package/src/renderer/src/i18n/index.ts +27 -0
  23. package/src/renderer/src/i18n/locales/en.json +8 -0
  24. package/src/renderer/src/i18n/locales/fr.json +8 -0
  25. package/src/renderer/src/index.css +59 -0
  26. package/src/renderer/src/lib/utils.ts +6 -0
  27. package/src/renderer/src/main.tsx +66 -0
  28. package/src/renderer/src/stores/app-store.ts +20 -0
  29. package/tailwind.config.js +53 -0
  30. package/template/.github/workflows/ci.yml +77 -0
  31. package/template/electron.vite.config.ts +46 -0
  32. package/template/eslint.config.js +28 -0
  33. package/template/package.json +31 -0
  34. package/template/postcss.config.js +6 -0
  35. package/template/src/main/index.ts +110 -0
  36. package/template/src/preload/index.ts +33 -0
  37. package/template/src/renderer/env.d.ts +16 -0
  38. package/template/src/renderer/index.html +16 -0
  39. package/template/src/renderer/src/components/mode-toggle.tsx +31 -0
  40. package/template/src/renderer/src/components/theme-provider.tsx +140 -0
  41. package/template/src/renderer/src/components/ui/button.tsx +50 -0
  42. package/template/src/renderer/src/components/ui/dropdown-menu.tsx +188 -0
  43. package/template/src/renderer/src/components/use-theme.ts +12 -0
  44. package/template/src/renderer/src/hooks/use-sample.ts +7 -0
  45. package/template/src/renderer/src/i18n/index.ts +27 -0
  46. package/template/src/renderer/src/i18n/locales/en.json +8 -0
  47. package/template/src/renderer/src/i18n/locales/fr.json +8 -0
  48. package/template/src/renderer/src/index.css +59 -0
  49. package/template/src/renderer/src/lib/utils.ts +6 -0
  50. package/template/src/renderer/src/main.tsx +66 -0
  51. package/template/src/renderer/src/stores/app-store.ts +20 -0
  52. package/template/tailwind.config.js +53 -0
  53. package/template/template-package.json +57 -0
  54. package/template/tsconfig.json +7 -0
  55. package/template/tsconfig.node.json +20 -0
  56. package/template/tsconfig.web.json +25 -0
  57. package/template/vitest.config.ts +17 -0
  58. package/tests/renderer/sample.test.ts +7 -0
  59. package/tsconfig.json +7 -0
  60. package/tsconfig.node.json +20 -0
  61. package/tsconfig.web.json +25 -0
  62. package/vitest.config.ts +17 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(gh issue update:*)",
5
+ "Bash(git add:*)",
6
+ "Bash(git commit:*)",
7
+ "Bash(pnpm typecheck)",
8
+ "Bash(pnpm lint)",
9
+ "Bash(pnpm test)",
10
+ "Bash(pnpm add:*)",
11
+ "Bash(gh run list:*)",
12
+ "Bash(gh run view:*)"
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,77 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Setup pnpm
17
+ uses: pnpm/action-setup@v4
18
+ with:
19
+ version: 9
20
+
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: 20
25
+ cache: 'pnpm'
26
+
27
+ - name: Install dependencies
28
+ run: pnpm install --frozen-lockfile
29
+
30
+ - name: Run linter
31
+ run: pnpm lint
32
+
33
+ typecheck:
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - name: Checkout code
37
+ uses: actions/checkout@v4
38
+
39
+ - name: Setup pnpm
40
+ uses: pnpm/action-setup@v4
41
+ with:
42
+ version: 9
43
+
44
+ - name: Setup Node.js
45
+ uses: actions/setup-node@v4
46
+ with:
47
+ node-version: 20
48
+ cache: 'pnpm'
49
+
50
+ - name: Install dependencies
51
+ run: pnpm install --frozen-lockfile
52
+
53
+ - name: Run typecheck
54
+ run: pnpm typecheck
55
+
56
+ test:
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - name: Checkout code
60
+ uses: actions/checkout@v4
61
+
62
+ - name: Setup pnpm
63
+ uses: pnpm/action-setup@v4
64
+ with:
65
+ version: 9
66
+
67
+ - name: Setup Node.js
68
+ uses: actions/setup-node@v4
69
+ with:
70
+ node-version: 20
71
+ cache: 'pnpm'
72
+
73
+ - name: Install dependencies
74
+ run: pnpm install --frozen-lockfile
75
+
76
+ - name: Run tests
77
+ run: pnpm test
@@ -0,0 +1,58 @@
1
+ # Contributing to Electron Vite React Template
2
+
3
+ Thank you for your interest in contributing!
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository
8
+ 2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/electron-vite-react-template.git`
9
+ 3. Create a feature branch: `git checkout -b feature/my-feature`
10
+
11
+ ## Development Setup
12
+
13
+ ```bash
14
+ # Install dependencies
15
+ pnpm install
16
+
17
+ # Approve build scripts
18
+ pnpm approve-builds
19
+
20
+ # Start development server
21
+ pnpm dev
22
+ ```
23
+
24
+ ## Coding Standards
25
+
26
+ - Use TypeScript for all new code
27
+ - Run `pnpm lint` before committing
28
+ - Run `pnpm typecheck` to check types
29
+ - Run `pnpm test` to ensure tests pass
30
+
31
+ ## Commit Messages
32
+
33
+ Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
34
+
35
+ - `feat:` New feature
36
+ - `fix:` Bug fix
37
+ - `docs:` Documentation changes
38
+ - `style:` Code style changes (formatting, semicolons, etc.)
39
+ - `refactor:` Code refactoring
40
+ - `test:` Adding or updating tests
41
+ - `chore:` Maintenance tasks
42
+
43
+ Example: `feat: add new theme provider option`
44
+
45
+ ## Pull Request Process
46
+
47
+ 1. Update documentation if needed
48
+ 2. Ensure all tests pass and linting is clean
49
+ 3. Update the CHANGELOG.md if applicable
50
+ 4. Submit a pull request to the `main` branch
51
+
52
+ ## Code of Conduct
53
+
54
+ Be respectful and inclusive. We follow the [Contributor Covenant](https://www.contributor-covenant.org/).
55
+
56
+ ## Questions?
57
+
58
+ Feel free to open an issue for questions about contributing.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nesalia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ # Electron + Vite + React Template
2
+
3
+ A modern Electron desktop application template with Vite, React, and TypeScript.
4
+
5
+ ## Features
6
+
7
+ - **Electron** - Desktop application framework
8
+ - **Vite** - Fast build tool and dev server
9
+ - **React 18** - UI library
10
+ - **TypeScript** - Type-safe JavaScript
11
+ - **TanStack Query** - Server state management
12
+ - **Zustand** - Client state management
13
+ - **TanStack Router** - Type-safe routing
14
+ - **shadcn/ui** - Accessible UI components (Button, DropdownMenu)
15
+ - **Tailwind CSS** - Utility-first CSS framework
16
+ - **Theme Support** - Native system theme detection (dark/light)
17
+ - **i18n** - Internationalization with react-i18next (English & French)
18
+ - **Vitest** - Testing framework
19
+ - **ESLint** - Code linting
20
+ - **GitHub Actions** - CI/CD pipeline
21
+
22
+ ## Getting Started
23
+
24
+ ### Prerequisites
25
+
26
+ - Node.js 20+
27
+ - pnpm 9+
28
+
29
+ ### Installation
30
+
31
+ ```bash
32
+ # Clone the repository
33
+ git clone https://github.com/nesalia-inc/electron-vite-react-template.git
34
+
35
+ # Install dependencies
36
+ pnpm install
37
+
38
+ # Approve build scripts (for electron)
39
+ pnpm approve-builds
40
+ ```
41
+
42
+ ### Development
43
+
44
+ ```bash
45
+ # Start development server
46
+ pnpm dev
47
+ ```
48
+
49
+ The app will open at `http://127.0.0.1:8888`
50
+
51
+ ### Build
52
+
53
+ ```bash
54
+ # Build for production
55
+ pnpm build
56
+ ```
57
+
58
+ ### Testing
59
+
60
+ ```bash
61
+ # Run tests
62
+ pnpm test
63
+
64
+ # Run tests with UI
65
+ pnpm test:ui
66
+ ```
67
+
68
+ ### Linting
69
+
70
+ ```bash
71
+ # Run linter
72
+ pnpm lint
73
+
74
+ # Run type checking
75
+ pnpm typecheck
76
+ ```
77
+
78
+ ## Project Structure
79
+
80
+ ```
81
+ src/
82
+ ├── main/ # Electron main process
83
+ │ └── index.ts # Main process entry point
84
+ ├── preload/ # Preload scripts
85
+ │ └── index.ts # Preload script entry point
86
+ └── renderer/ # React application
87
+ ├── src/
88
+ │ ├── components/ # React components
89
+ │ │ └── ui/ # shadcn/ui components
90
+ │ ├── hooks/ # Custom React hooks
91
+ │ ├── i18n/ # Internationalization
92
+ │ ├── lib/ # Utilities
93
+ │ ├── stores/ # Zustand stores
94
+ │ └── main.tsx # Renderer entry point
95
+ └── index.html # HTML entry point
96
+ ```
97
+
98
+ ## Configuration
99
+
100
+ ### electron.vite.config.ts
101
+
102
+ Configuration for electron-vite build tool.
103
+
104
+ ### tailwind.config.js
105
+
106
+ Tailwind CSS configuration with custom theme variables.
107
+
108
+ ### tsconfig.json
109
+
110
+ TypeScript configuration (node + web split).
111
+
112
+ ### vitest.config.ts
113
+
114
+ Vitest testing configuration.
115
+
116
+ ## Theme Support
117
+
118
+ The template includes a theme provider that supports:
119
+
120
+ - **Light** - Light mode
121
+ - **Dark** - Dark mode
122
+ - **System** - Follows system preference
123
+
124
+ The theme automatically detects system theme changes in real-time.
125
+
126
+ ## Internationalization
127
+
128
+ The template supports multiple languages:
129
+
130
+ - English (en)
131
+ - French (fr)
132
+
133
+ The language is automatically detected from the system locale.
134
+
135
+ ## Tech Stack
136
+
137
+ | Category | Technology |
138
+ |----------|------------|
139
+ | Framework | Electron |
140
+ | Build Tool | Vite |
141
+ | UI | React |
142
+ | Language | TypeScript |
143
+ | State | TanStack Query + Zustand |
144
+ | Routing | TanStack Router |
145
+ | Styling | Tailwind CSS |
146
+ | Components | shadcn/ui |
147
+ | i18n | react-i18next |
148
+ | Testing | Vitest |
149
+ | Linting | ESLint |
150
+
151
+ ## License
152
+
153
+ MIT
154
+
155
+ ## Author
156
+
157
+ Nesalia
package/SECURITY.md ADDED
@@ -0,0 +1,29 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | 1.0.x | :white_check_mark: |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ If you discover a security vulnerability, please send an email to security@nesalia.com. All security vulnerabilities will be promptly addressed.
12
+
13
+ Please include the following information:
14
+
15
+ - Type of vulnerability
16
+ - Full paths of source file(s) related to the vulnerability
17
+ - Location of the affected source code (tag/branch/commit or direct URL)
18
+ - Any special configuration required to reproduce the issue
19
+ - Step-by-step instructions to reproduce the issue
20
+ - Proof-of-concept or exploit code (if possible)
21
+ - Impact of the issue
22
+
23
+ ## Response Timeline
24
+
25
+ We aim to acknowledge vulnerability reports within 48 hours and provide a more detailed response within 7 days. We will work with you to understand and address the vulnerability.
26
+
27
+ ## Security Updates
28
+
29
+ Security updates will be released as patch versions and announced in the release notes.
@@ -0,0 +1,249 @@
1
+ # Electron + Vite Template Specification
2
+
3
+ ## Overview
4
+
5
+ This document defines the specifications for an Electron desktop application template using Vite as the build tool.
6
+
7
+ ## Technology Stack
8
+
9
+ | Category | Technology |
10
+ |----------|------------|
11
+ | UI Framework | React |
12
+ | Language | TypeScript |
13
+ | Build Tool (Renderer) | Vite |
14
+ | Packaging | electron-vite |
15
+ | State Management | TanStack Query + Zustand |
16
+ | Routing | TanStack Router |
17
+ | UI Components | shadcn/ui |
18
+ | Styling | Tailwind CSS + CSS Variables |
19
+ | Theme | Native system theme (dark/light) |
20
+ | i18n | react-i18next |
21
+ | Testing | Vitest |
22
+ | Logging | electron-log |
23
+ | IPC Pattern | contextBridge + ipcRenderer |
24
+
25
+ ## Architecture
26
+
27
+ ### Project Structure
28
+
29
+ Following electron-vite recommended convention:
30
+
31
+ ```
32
+ electron-vite-react-template/
33
+ ├── src/
34
+ │ ├── main/
35
+ │ │ ├── index.ts # Main process entry point
36
+ │ │ └── ... # Main process modules
37
+ │ ├── preload/
38
+ │ │ ├── index.ts # Preload script entry point
39
+ │ │ └── ... # Preload modules
40
+ │ └── renderer/
41
+ │ ├── src/
42
+ │ │ ├── components/ # React components (including shadcn)
43
+ │ │ │ └── ui/ # shadcn/ui components
44
+ │ │ ├── hooks/ # Custom React hooks
45
+ │ │ ├── lib/ # Utilities and helpers
46
+ │ │ ├── routes/ # TanStack Router routes
47
+ │ │ ├── stores/ # Zustand stores
48
+ │ │ ├── i18n/ # i18n configuration and translations
49
+ │ │ ├── App.tsx # Root component
50
+ │ │ └── main.tsx # Renderer entry point
51
+ │ ├── index.html # Renderer HTML entry
52
+ │ └── env.d.ts # TypeScript declarations
53
+ ├── tests/ # Test files
54
+ │ ├── main/ # Main process tests
55
+ │ ├── preload/ # Preload script tests
56
+ │ └── renderer/ # Renderer tests
57
+ ├── electron.vite.config.ts
58
+ ├── package.json
59
+ ├── tailwind.config.js
60
+ ├── tsconfig.json
61
+ ├── tsconfig.node.json
62
+ ├── tsconfig.web.json
63
+ ├── vitest.config.ts
64
+ └── .github/
65
+ └── workflows/
66
+ └── ci.yml # CI: lint, type-check, test
67
+ ```
68
+
69
+ **Default entry points (electron-vite auto-discovery):**
70
+ - Main process: `src/main/index.ts`
71
+ - Preload script: `src/preload/index.ts`
72
+ - Renderer: `src/renderer/index.html`
73
+
74
+ ### Process Model
75
+
76
+ - **Main Process**: Handles window management, native APIs, file system operations, and IPC communication
77
+ - **Preload Script**: Exposes safe APIs to renderer via contextBridge
78
+ - **Renderer Process**: React application running in Chromium
79
+
80
+ ## Core Features
81
+
82
+ ### IPC Communication
83
+
84
+ Communication between main and renderer processes uses `contextBridge` pattern:
85
+
86
+ - Expose safe APIs to renderer via contextBridge
87
+ - Using @electron-toolkit/preload for Electron APIs
88
+ - Type-safe IPC with ipcRenderer.invoke
89
+
90
+ ```typescript
91
+ // Preload
92
+ contextBridge.exposeInMainWorld('api', {
93
+ getSystemTheme: () => ipcRenderer.invoke('get-system-theme')
94
+ })
95
+
96
+ // Renderer
97
+ const theme = await window.api.getSystemTheme()
98
+ ```
99
+
100
+ ### State Management
101
+
102
+ - **Zustand**: Global client state (user preferences, UI state)
103
+ - **TanStack Query**: Server state (API calls, caching, synchronization)
104
+ - **TanStack Router**: Type-safe routing with file-based routing support
105
+
106
+ ### UI Components
107
+
108
+ - **shadcn/ui**: Accessible, customizable component library built on Radix UI
109
+ - Components installed individually as needed
110
+ - Follows Tailwind CSS best practices
111
+
112
+ ### Logging
113
+
114
+ - `electron-log` for main and preload processes
115
+ - Console logging in renderer (can be connected to main process logs)
116
+ - Log files stored in user data directory
117
+
118
+ ### Styling
119
+
120
+ - Tailwind CSS for utility-first styling
121
+ - CSS variables for theming
122
+ - shadcn/ui components use Tailwind CSS with CSS variables
123
+
124
+ ### Theme Support
125
+
126
+ Based on shadcn/ui theme provider:
127
+
128
+ - `ThemeProvider` component with system/dark/light modes
129
+ - `useTheme` hook for theme management
130
+ - `ModeToggle` component for user preference
131
+ - Native system theme detection via Electron `nativeTheme` API
132
+ - Real-time listener for OS theme changes
133
+ - Persist user preference in localStorage
134
+
135
+ ### Internationalization (i18n)
136
+
137
+ - `react-i18next` for translations
138
+ - Support for multiple locales
139
+ - Language detection from system locale
140
+ - Lazy loading of translation files
141
+
142
+ ## Development Workflow
143
+
144
+ ### Scripts
145
+
146
+ ```bash
147
+ # Development
148
+ npm run dev # Start dev server
149
+ npm run build # Build for production
150
+
151
+ # Electron
152
+ npm run electron:dev # Run Electron in dev mode
153
+ npm run electron:build # Build Electron app
154
+
155
+ # Testing
156
+ npm run test # Run tests
157
+ npm run test:ui # Run tests with UI
158
+ ```
159
+
160
+ ### Environment Variables
161
+
162
+ ```
163
+ VITE_DEV_SERVER_URL # Development server URL
164
+ NODE_ENV # Environment (development/production)
165
+ ```
166
+
167
+ ## Build Configuration
168
+
169
+ ### electron-vite
170
+
171
+ Configuration handles:
172
+ - Main process build
173
+ - Preload script build
174
+ - Renderer build (Vite)
175
+ - Asset handling
176
+
177
+ ### Packaging
178
+
179
+ Output formats:
180
+ - Windows: NSIS installer, portable exe
181
+ - macOS: DMG, zip
182
+ - Linux: AppImage, deb
183
+
184
+ ## CI/CD
185
+
186
+ GitHub Actions workflow (`.github/workflows/ci.yml`):
187
+
188
+ ```yaml
189
+ name: CI
190
+
191
+ on: [push, pull_request]
192
+
193
+ jobs:
194
+ lint:
195
+ runs-on: ubuntu-latest
196
+ steps:
197
+ - uses: actions/checkout@v4
198
+ - uses: pnpm/action-setup@v4
199
+ - uses: actions/setup-node@v4
200
+ with:
201
+ node-version: 20
202
+ cache: 'pnpm'
203
+ - run: pnpm install
204
+ - run: pnpm lint
205
+
206
+ typecheck:
207
+ runs-on: ubuntu-latest
208
+ steps:
209
+ - uses: actions/checkout@v4
210
+ - uses: pnpm/action-setup@v4
211
+ - uses: actions/setup-node@v4
212
+ with:
213
+ node-version: 20
214
+ cache: 'pnpm'
215
+ - run: pnpm install
216
+ - run: pnpm typecheck
217
+
218
+ test:
219
+ runs-on: ubuntu-latest
220
+ steps:
221
+ - uses: actions/checkout@v4
222
+ - uses: pnpm/action-setup@v4
223
+ - uses: actions/setup-node@v4
224
+ with:
225
+ node-version: 20
226
+ cache: 'pnpm'
227
+ - run: pnpm install
228
+ - run: pnpm test
229
+ ```
230
+
231
+ ## Testing Strategy
232
+
233
+ - Vitest for unit and integration tests
234
+ - Component testing with React Testing Library
235
+ - IPC communication tests (main process)
236
+
237
+ ## Security Considerations
238
+
239
+ - Context isolation enabled
240
+ - Node integration disabled in renderer
241
+ - contextBridge handles IPC communication safely via preload
242
+ - CSP headers configured
243
+
244
+ ## Future Considerations
245
+
246
+ - Auto-update mechanism (electron-updater)
247
+ - ESLint + Prettier configuration
248
+ - CI/CD pipeline
249
+ - Database integration (SQLite via better-sqlite3)
@@ -0,0 +1,46 @@
1
+ import { resolve } from 'path'
2
+ import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
3
+ import react from '@vitejs/plugin-react'
4
+
5
+ export default defineConfig({
6
+ main: {
7
+ plugins: [externalizeDepsPlugin()],
8
+ build: {
9
+ rollupOptions: {
10
+ input: {
11
+ index: resolve(__dirname, 'src/main/index.ts')
12
+ }
13
+ }
14
+ }
15
+ },
16
+ preload: {
17
+ plugins: [externalizeDepsPlugin()],
18
+ build: {
19
+ rollupOptions: {
20
+ input: {
21
+ index: resolve(__dirname, 'src/preload/index.ts')
22
+ }
23
+ }
24
+ }
25
+ },
26
+ renderer: {
27
+ root: resolve(__dirname, 'src/renderer'),
28
+ server: {
29
+ port: 8888,
30
+ host: '127.0.0.1'
31
+ },
32
+ build: {
33
+ rollupOptions: {
34
+ input: {
35
+ index: resolve(__dirname, 'src/renderer/index.html')
36
+ }
37
+ }
38
+ },
39
+ plugins: [react()],
40
+ resolve: {
41
+ alias: {
42
+ '@': resolve(__dirname, 'src/renderer/src')
43
+ }
44
+ }
45
+ }
46
+ })
@@ -0,0 +1,28 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+
7
+ export default tseslint.config(
8
+ { ignores: ['dist', 'out', 'node_modules'] },
9
+ {
10
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
11
+ files: ['**/*.{ts,tsx}'],
12
+ languageOptions: {
13
+ ecmaVersion: 2020,
14
+ globals: globals.browser
15
+ },
16
+ plugins: {
17
+ 'react-hooks': reactHooks,
18
+ 'react-refresh': reactRefresh
19
+ },
20
+ rules: {
21
+ ...reactHooks.configs.recommended.rules,
22
+ 'react-refresh/only-export-components': [
23
+ 'warn',
24
+ { allowConstantExport: true }
25
+ ]
26
+ }
27
+ }
28
+ )