Skip to content

Commit e02539d

Browse files
committed
feat: add support VSCode launch.json
1 parent 9a85dbe commit e02539d

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

.vscode/launch.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "1.0.0",
3+
"compounds": [
4+
{
5+
"name": "Debug Run",
6+
"configurations": [
7+
"Debug App"
8+
],
9+
"presentation": {
10+
"hidden": false,
11+
"group": "",
12+
"order": 1
13+
},
14+
"stopAll": true
15+
}
16+
],
17+
"configurations": [
18+
{
19+
"name": "Debug App",
20+
"request": "launch",
21+
"type": "node",
22+
"timeout": 60000,
23+
"runtimeArgs": [
24+
"run-script",
25+
"dev"
26+
],
27+
"cwd": "${workspaceRoot}",
28+
"runtimeExecutable": "npm",
29+
"console": "integratedTerminal"
30+
}
31+
]
32+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"workbench.settings.useSplitJSON": true,
33
"eslint.codeActionsOnSave.rules": null,
44
"editor.codeActionsOnSave": {
5-
"source.fixAll.eslint": true
5+
"source.fixAll.eslint": "explicit"
66
},
77
"eslint.validate": [
88
"javascript"

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"bugs": {
1616
"url": "https://github.com/jooy2/retron/issues"
1717
},
18+
"debug": {
19+
"env": {
20+
"VITE_DEV_SERVER_URL": "http://localhost:5173"
21+
}
22+
},
1823
"engines": {
1924
"node": ">=18.0.0"
2025
},

src/main/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { app, BrowserWindow } from 'electron';
33
import { dirname, join } from 'path';
44
import { fileURLToPath } from 'url';
55
import IPCs from './IPCs';
6+
import { debug } from '../../package.json';
67

78
global.IS_DEV = process.env.NODE_ENV === 'development';
89

@@ -50,7 +51,7 @@ const createWindow = async () => {
5051
});
5152

5253
if (global.IS_DEV) {
53-
await mainWindow.loadURL('http://localhost:5173');
54+
await mainWindow.loadURL(debug.env.VITE_DEV_SERVER_URL);
5455
} else {
5556
await mainWindow.loadFile(join(currentDirName, '../index.html'));
5657
}

0 commit comments

Comments
 (0)