Skip to content

Commit 65c0ec7

Browse files
committed
feat: init with electron-vite
0 parents  commit 65c0ec7

36 files changed

+6091
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
out
4+
.gitignore

.eslintrc.cjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:react/recommended',
5+
'plugin:react/jsx-runtime',
6+
'@electron-toolkit/eslint-config-ts/recommended',
7+
'@electron-toolkit/eslint-config-prettier'
8+
]
9+
}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
out
4+
.DS_Store
5+
*.log*

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shamefully-hoist=true

.prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
out
2+
dist
3+
pnpm-lock.yaml
4+
LICENSE.md
5+
tsconfig.json
6+
tsconfig.*.json

.prettierrc.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
singleQuote: true
2+
semi: false
3+
printWidth: 100
4+
trailingComma: none

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["dbaeumer.vscode-eslint"]
3+
}

.vscode/launch.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Main Process",
6+
"type": "node",
7+
"request": "launch",
8+
"cwd": "${workspaceRoot}",
9+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite",
10+
"windows": {
11+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-vite.cmd"
12+
},
13+
"runtimeArgs": ["--sourcemap"],
14+
"env": {
15+
"REMOTE_DEBUGGING_PORT": "9222"
16+
}
17+
},
18+
{
19+
"name": "Debug Renderer Process",
20+
"port": 9222,
21+
"request": "attach",
22+
"type": "chrome",
23+
"webRoot": "${workspaceFolder}/src/renderer",
24+
"timeout": 60000,
25+
"presentation": {
26+
"hidden": true
27+
}
28+
}
29+
],
30+
"compounds": [
31+
{
32+
"name": "Debug All",
33+
"configurations": ["Debug Main Process", "Debug Renderer Process"],
34+
"presentation": {
35+
"order": 1
36+
}
37+
}
38+
]
39+
}

.vscode/settings.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"[typescript]": {
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
},
5+
"[javascript]": {
6+
"editor.defaultFormatter": "esbenp.prettier-vscode"
7+
},
8+
"[json]": {
9+
"editor.defaultFormatter": "esbenp.prettier-vscode"
10+
}
11+
}

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# rere
2+
3+
An Electron application with React and TypeScript
4+
5+
## Recommended IDE Setup
6+
7+
- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
8+
9+
## Project Setup
10+
11+
### Install
12+
13+
```bash
14+
$ pnpm install
15+
```
16+
17+
### Development
18+
19+
```bash
20+
$ pnpm dev
21+
```
22+
23+
### Build
24+
25+
```bash
26+
# For windows
27+
$ pnpm build:win
28+
29+
# For macOS
30+
$ pnpm build:mac
31+
32+
# For Linux
33+
$ pnpm build:linux
34+
```

build/entitlements.mac.plist

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8+
<true/>
9+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
10+
<true/>
11+
</dict>
12+
</plist>

build/icon.icns

83.6 KB
Binary file not shown.

build/icon.ico

121 KB
Binary file not shown.

build/icon.png

35.1 KB
Loading

dev-app-update.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
provider: generic
2+
url: https://example.com/auto-updates
3+
updaterCacheDirName: rere-updater

electron-builder.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
appId: com.electron.app
2+
productName: rere
3+
directories:
4+
buildResources: build
5+
files:
6+
- '!**/.vscode/*'
7+
- '!src/*'
8+
- '!electron.vite.config.{js,ts,mjs,cjs}'
9+
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
10+
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
11+
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
12+
asarUnpack:
13+
- resources/**
14+
win:
15+
executableName: rere
16+
nsis:
17+
artifactName: ${name}-${version}-setup.${ext}
18+
shortcutName: ${productName}
19+
uninstallDisplayName: ${productName}
20+
createDesktopShortcut: always
21+
mac:
22+
entitlementsInherit: build/entitlements.mac.plist
23+
extendInfo:
24+
- NSCameraUsageDescription: Application requests access to the device's camera.
25+
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
26+
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
27+
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
28+
notarize: false
29+
dmg:
30+
artifactName: ${name}-${version}.${ext}
31+
linux:
32+
target:
33+
- AppImage
34+
- snap
35+
- deb
36+
maintainer: electronjs.org
37+
category: Utility
38+
appImage:
39+
artifactName: ${name}-${version}.${ext}
40+
npmRebuild: false
41+
publish:
42+
provider: generic
43+
url: https://example.com/auto-updates

electron.vite.config.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
},
9+
preload: {
10+
plugins: [externalizeDepsPlugin()]
11+
},
12+
renderer: {
13+
resolve: {
14+
alias: {
15+
'@renderer': resolve('src/renderer/src')
16+
}
17+
},
18+
plugins: [react()]
19+
}
20+
})

package.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "rere",
3+
"version": "1.0.0",
4+
"description": "An Electron application with React and TypeScript",
5+
"main": "./out/main/index.js",
6+
"author": "example.com",
7+
"homepage": "https://electron-vite.org",
8+
"scripts": {
9+
"format": "prettier --write .",
10+
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
11+
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
12+
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
13+
"typecheck": "npm run typecheck:node && npm run typecheck:web",
14+
"start": "electron-vite preview",
15+
"dev": "electron-vite dev",
16+
"build": "npm run typecheck && electron-vite build",
17+
"postinstall": "electron-builder install-app-deps",
18+
"build:unpack": "npm run build && electron-builder --dir",
19+
"build:win": "npm run build && electron-builder --win",
20+
"build:mac": "electron-vite build && electron-builder --mac",
21+
"build:linux": "electron-vite build && electron-builder --linux"
22+
},
23+
"dependencies": {
24+
"@electron-toolkit/preload": "^3.0.0",
25+
"@electron-toolkit/utils": "^3.0.0",
26+
"electron-updater": "^6.1.7"
27+
},
28+
"devDependencies": {
29+
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
30+
"@electron-toolkit/eslint-config-ts": "^2.0.0",
31+
"@electron-toolkit/tsconfig": "^1.0.1",
32+
"@types/node": "^20.12.7",
33+
"@types/react": "^18.2.48",
34+
"@types/react-dom": "^18.2.18",
35+
"@vitejs/plugin-react": "^4.2.1",
36+
"electron": "^29.2.0",
37+
"electron-builder": "^24.9.1",
38+
"electron-vite": "^2.0.0",
39+
"eslint": "^9.0.0",
40+
"eslint-plugin-react": "^7.33.2",
41+
"prettier": "^3.2.4",
42+
"react": "^18.2.0",
43+
"react-dom": "^18.2.0",
44+
"typescript": "^5.3.3",
45+
"vite": "^5.0.12"
46+
}
47+
}

0 commit comments

Comments
 (0)