Skip to content

Commit

Permalink
feat: add support VSCode launch.json
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Jan 22, 2025
1 parent 9a85dbe commit e02539d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "1.0.0",
"compounds": [
{
"name": "Debug Run",
"configurations": [
"Debug App"
],
"presentation": {
"hidden": false,
"group": "",
"order": 1
},
"stopAll": true
}
],
"configurations": [
{
"name": "Debug App",
"request": "launch",
"type": "node",
"timeout": 60000,
"runtimeArgs": [
"run-script",
"dev"
],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"console": "integratedTerminal"
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"workbench.settings.useSplitJSON": true,
"eslint.codeActionsOnSave.rules": null,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript"
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"bugs": {
"url": "https://github.com/jooy2/retron/issues"
},
"debug": {
"env": {
"VITE_DEV_SERVER_URL": "http://localhost:5173"
}
},
"engines": {
"node": ">=18.0.0"
},
Expand Down
3 changes: 2 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { app, BrowserWindow } from 'electron';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import IPCs from './IPCs';
import { debug } from '../../package.json';

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

Expand Down Expand Up @@ -50,7 +51,7 @@ const createWindow = async () => {
});

if (global.IS_DEV) {
await mainWindow.loadURL('http://localhost:5173');
await mainWindow.loadURL(debug.env.VITE_DEV_SERVER_URL);
} else {
await mainWindow.loadFile(join(currentDirName, '../index.html'));
}
Expand Down

0 comments on commit e02539d

Please sign in to comment.