Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 279a3ca

Browse files
committed
init
0 parents  commit 279a3ca

File tree

26 files changed

+4677
-0
lines changed

26 files changed

+4677
-0
lines changed

.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"ecmaVersion": "latest",
5+
"sourceType": "module",
6+
"ecmaFeatures": {
7+
"jsx": true
8+
}
9+
},
10+
"settings": {
11+
"react": {
12+
"version": "detect"
13+
}
14+
},
15+
"env": {
16+
"browser": true,
17+
"amd": true,
18+
"node": true
19+
},
20+
"extends": ["eslint:recommended", "plugin:react/recommended", "plugin:prettier/recommended"],
21+
"plugins": ["prettier"],
22+
"rules": {
23+
"react/react-in-jsx-scope": "off",
24+
"no-unused-vars": "warn"
25+
}
26+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
target
2+
index.node
3+
**/node_modules
4+
**/.DS_Store
5+
npm-debug.log*
6+
dist

.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"arrowParens": "avoid",
3+
"endOfLine": "auto",
4+
"singleQuote": true,
5+
"trailingComma": "all",
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"printWidth": 100,
9+
"semi": true,
10+
"importOrder": ["electron", "react", "^[^.~]+", "^~.+$", "^\\..+$"],
11+
"importOrderSeparation": true
12+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"editor.tabSize": 2,
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "esbenp.prettier-vscode",
5+
"typescript.preferences.importModuleSpecifier": "shortest",
6+
"typescript.tsdk": "node_modules/typescript/lib"
7+
}

electron/index.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { app, BrowserWindow } from 'electron';
2+
3+
import { join } from 'path';
4+
5+
global.win = null;
6+
7+
const DEV_URL = `http://localhost:3000`;
8+
const PROD_FILE_PATH = join(__dirname, '../index.html');
9+
10+
const gotTheLock = app.requestSingleInstanceLock();
11+
12+
if (!gotTheLock) {
13+
app.quit();
14+
process.exit(0);
15+
}
16+
17+
const createWindow = () => {
18+
if (global.win) {
19+
if (global.win.isMinimized()) global.win.restore();
20+
global.win.focus();
21+
return;
22+
}
23+
24+
const win = new BrowserWindow({
25+
width: 800,
26+
height: 600,
27+
});
28+
29+
if (app.isPackaged) {
30+
win.loadFile(PROD_FILE_PATH);
31+
} else {
32+
win.webContents.openDevTools();
33+
win.loadURL(DEV_URL);
34+
}
35+
};
36+
37+
app.on('activate', () => {
38+
createWindow();
39+
});
40+
41+
app.on('second-instance', () => {
42+
createWindow();
43+
});
44+
45+
app.on('window-all-closed', () => {
46+
global.win = null;
47+
});
48+
49+
app.whenReady().then(() => {
50+
createWindow();
51+
});

electron/preload/index.ts

Whitespace-only changes.

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/index.tsx"></script>
12+
</body>
13+
</html>

package.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "electron-vite-react-ts-template",
3+
"private": true,
4+
"version": "0.0.1",
5+
"description": "electron-vite-react-ts-template",
6+
"main": "dist/electron/index.js",
7+
"scripts": {
8+
"dev": "vite",
9+
"build": "tsc && vite build && electron-builder"
10+
},
11+
"dependencies": {
12+
"@tanstack/react-location": "^3.7.4",
13+
"clsx": "^1.2.1",
14+
"dayjs": "^1.11.4",
15+
"electron-store": "^8.1.0",
16+
"formik": "^2.2.9",
17+
"generouted": "^1.5.0",
18+
"react": "^18.2.0",
19+
"react-dom": "^18.2.0",
20+
"react-router-dom": "^6.3.0",
21+
"recoil": "^0.7.4",
22+
"styled-components": "^5.3.5"
23+
},
24+
"devDependencies": {
25+
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
26+
"@types/node": "^18.6.2",
27+
"@types/react": "^18.0.15",
28+
"@types/react-dom": "^18.0.6",
29+
"@types/styled-components": "^5.1.25",
30+
"@vitejs/plugin-react": "^2.0.0",
31+
"cross-env": "^7.0.3",
32+
"electron": "^20.0.1",
33+
"electron-builder": "^23.3.3",
34+
"eslint": "^8.20.0",
35+
"eslint-config-prettier": "^8.5.0",
36+
"eslint-plugin-prettier": "^4.2.1",
37+
"eslint-plugin-react": "^7.30.1",
38+
"prettier": "^2.7.1",
39+
"typescript": "^4.6.4",
40+
"typescript-styled-plugin": "^0.18.2",
41+
"vite": "^3.0.0",
42+
"vite-plugin-checker": "^0.4.9",
43+
"vite-plugin-electron": "^0.8.4",
44+
"vite-plugin-svgr": "^2.2.1",
45+
"vite-tsconfig-paths": "^3.5.0"
46+
},
47+
"build": {
48+
"appId": "com.test.templateapp",
49+
"productName": "TemplateApp",
50+
"asar": true,
51+
"win": {
52+
"target": "nsis"
53+
},
54+
"nsis": {
55+
"oneClick": true,
56+
"artifactName": "TemplateApp 설치 ${version}.${ext}",
57+
"uninstallDisplayName": "TemplateApp",
58+
"installerIcon": "resources/windows/logo.ico"
59+
},
60+
"files": [
61+
"dist/**/*"
62+
],
63+
"extraResources": [
64+
"./resources/**"
65+
]
66+
}
67+
}

public/vite.svg

Lines changed: 1 addition & 0 deletions
Loading

resources/windows/logo.ico

132 KB
Binary file not shown.

0 commit comments

Comments
 (0)