refactor: upgrade deps, setup tailwind4 and correct ci (#258)
* refresh * e2e test * Change debugger type from 'pwa-chrome' to 'chrome' * ci: align workflows with electron-vite-vue#540 * chore: update test, tsconfig and deps * chore: update deps and debug config * chore: refresh style * docs: update readme * docs: make linter happy * ci: bump versions * chore: refactor update handling and improve UI elements * 1.0.0
This commit is contained in:
39 files changed
+855
-916
No files matched your search
@@ -1,24 +1,23 @@
|
||||
# electron-vite-react
|
||||
|
||||
[](https://github.com/vitejs/awesome-vite)
|
||||

|
||||

|
||||

|
||||
[](https://nodejs.org/about/releases)
|
||||

|
||||

|
||||

|
||||
[](https://nodejs.org/about/releases)
|
||||
|
||||
English | [简体中文](README.zh-CN.md)
|
||||
|
||||
## 👀 Overview
|
||||
## Overview
|
||||
|
||||
📦 Ready out of the box
|
||||
🎯 Based on the official [template-react-ts](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts), project structure will be familiar to you
|
||||
🌱 Easily extendable and customizable
|
||||
💪 Supports Node.js API in the renderer process
|
||||
🔩 Supports C/C++ native addons
|
||||
🐞 Debugger configuration included
|
||||
🖥 Easy to implement multiple windows
|
||||
- Ready out of the box.
|
||||
- Based on the official [template-react-ts](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts).
|
||||
- Supports Electron and Node.js APIs in the renderer process.
|
||||
- Supports C/C++ native addons.
|
||||
- Includes debugger configuration.
|
||||
- Easy to extend to multiple windows.
|
||||
|
||||
## 🛫 Quick Setup
|
||||
## Quick Start
|
||||
|
||||
```sh
|
||||
# clone the project
|
||||
@@ -27,65 +26,54 @@ git clone https://github.com/electron-vite/electron-vite-react.git
|
||||
# enter the project directory
|
||||
cd electron-vite-react
|
||||
|
||||
# install dependency
|
||||
npm install
|
||||
# install dependencies
|
||||
pnpm install
|
||||
|
||||
# develop
|
||||
npm run dev
|
||||
# start development
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
## 🐞 Debug
|
||||
## Available Scripts
|
||||
|
||||

|
||||
- `pnpm dev`: start the Vite dev server.
|
||||
- `pnpm build`: build the renderer and package the app with electron-builder.
|
||||
- `pnpm preview`: preview the production web build locally.
|
||||
- `pnpm test`: run Vitest unit tests.
|
||||
- `pnpm test:e2e`: build the test mode bundle and run Playwright tests.
|
||||
- `pnpm typecheck`: run the TypeScript type checker.
|
||||
|
||||
## 📂 Directory structure
|
||||
|
||||
Familiar React application structure, just with `electron` folder on the top :wink:
|
||||
*Files in this folder will be separated from your React application and built into `dist-electron`*
|
||||
## Project Structure
|
||||
|
||||
```tree
|
||||
├── electron Electron-related code
|
||||
│ ├── main Main-process source code
|
||||
│ └── preload Preload-scripts source code
|
||||
│
|
||||
├── release Generated after production build, contains executables
|
||||
│ └── {version}
|
||||
│ ├── {os}-{os_arch} Contains unpacked application executable
|
||||
│ └── {app_name}_{version}.{ext} Installer for the application
|
||||
│
|
||||
├── public Static assets
|
||||
└── src Renderer source code, your React application
|
||||
├── build/ Packaging assets
|
||||
├── dist-electron/ Compiled Electron output
|
||||
├── electron/ Main-process and preload source
|
||||
│ ├── main/
|
||||
│ └── preload/
|
||||
├── public/ Static assets
|
||||
├── src/ Renderer source code
|
||||
│ ├── components/
|
||||
│ │ └── update/
|
||||
│ ├── demos/
|
||||
│ └── type/
|
||||
└── test/ Unit and end-to-end tests
|
||||
└── e2e/
|
||||
```
|
||||
|
||||
<!--
|
||||
## 🚨 Be aware
|
||||
Files under `electron/` are compiled into `dist-electron/`.
|
||||
|
||||
This template integrates Node.js API to the renderer process by default. If you want to follow **Electron Security Concerns** you might want to disable this feature. You will have to expose needed API by yourself.
|
||||
## Security Note
|
||||
|
||||
To get started, remove the option as shown below. This will [modify the Vite configuration and disable this feature](https://github.com/electron-vite/vite-plugin-electron-renderer#config-presets-opinionated).
|
||||
The `renderer: {}` preset in `vite.config.ts` is only a Vite adapter that polyfills Electron, Node.js APIs and native modules for the renderer process. It is not the same as enabling Node integration. If you want direct Node.js access in the renderer, enable `nodeIntegration` in the `BrowserWindow` webPreferences in the main process and review the security impact carefully.
|
||||
|
||||
```diff
|
||||
# vite.config.ts
|
||||
## Features
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
...
|
||||
- // Use Node.js API in the Renderer-process
|
||||
- renderer({
|
||||
- nodeIntegration: true,
|
||||
- }),
|
||||
...
|
||||
],
|
||||
}
|
||||
```
|
||||
-->
|
||||
1. Electron auto update with docs in [src/components/update/README.md](src/components/update/README.md).
|
||||
2. Vitest unit tests and Playwright end-to-end tests.
|
||||
3. TailwindCSS v4.
|
||||
|
||||
## 🔧 Additional features
|
||||
|
||||
1. electron-updater 👉 [see docs](src/components/update/README.md)
|
||||
1. playwright
|
||||
|
||||
## ❔ FAQ
|
||||
## Resources
|
||||
|
||||
- Auto-update docs: [English](src/components/update/README.md) | [简体中文](src/components/update/README.zh-CN.md)
|
||||
- [C/C++ addons, Node.js modules - Pre-Bundling](https://github.com/electron-vite/vite-plugin-electron-renderer#dependency-pre-bundling)
|
||||
- [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies)
|
||||
Reference in new issue
Block a user