Skip to content

Commit f4225a3

Browse files
author
Maxime GRIS
committed
misc/ vscode debug
1 parent 54a42eb commit f4225a3

File tree

3 files changed

+59
-17
lines changed

3 files changed

+59
-17
lines changed

Diff for: .vscode/launch.json

+25-15
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,42 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Electron Main Renderer",
8+
"name": "Renderer",
9+
"type": "chrome",
10+
"request": "attach",
11+
"port": 9876,
12+
"url": "http://localhost:4200",
13+
"sourceMaps": true,
14+
"timeout": 10000,
15+
"trace": "verbose",
16+
"sourceMapPathOverrides": {
17+
"webpack:///./*": "${workspaceFolder}/*"
18+
},
19+
"preLaunchTask": "Build.Renderer"
20+
},
21+
{
22+
"name": "Main",
923
"type": "node",
1024
"request": "launch",
1125
"protocol": "inspector",
12-
// Prelaunch task compiles main.ts for Electron & starts Angular dev server.
13-
"preLaunchTask": "Build.All",
1426
"cwd": "${workspaceFolder}",
1527
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
28+
"trace": "verbose",
1629
"runtimeArgs": [
1730
"--serve",
1831
".",
19-
"--remote-debugging-port=9222"
32+
"--remote-debugging-port=9876"
2033
],
2134
"windows": {
2235
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
23-
}
24-
}, {
25-
"name": "Karma Attach Chrome",
26-
"type": "chrome",
27-
"request": "attach",
28-
"port": 9222,
29-
"webRoot": "${workspaceFolder}/",
30-
"sourceMaps": true,
31-
"timeout": 30000,
32-
"trace": true
36+
},
37+
"preLaunchTask": "Build.Main"
38+
}
39+
],
40+
"compounds": [
41+
{
42+
"name": "Application Debug",
43+
"configurations": [ "Renderer", "Main" ]
3344
}
34-
3545
]
3646
}

Diff for: .vscode/tasks.json

+24-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,31 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "Build.All",
5+
"label": "Build.Main",
66
"type": "shell",
7-
"command": "npm run electron:serve-tsc && ng serve",
7+
"command": "npm run electron:serve-tsc",
8+
"isBackground": false,
9+
"group": {
10+
"kind": "build",
11+
"isDefault": true
12+
},
13+
"problemMatcher": {
14+
"owner": "typescript",
15+
"source": "ts",
16+
"applyTo": "closedDocuments",
17+
"fileLocation": ["relative", "${cwd}"],
18+
"pattern": "$tsc",
19+
"background": {
20+
"activeOnStart": true,
21+
"beginsPattern": "^.*",
22+
"endsPattern": "^.*Terminal will be reused by tasks, press any key to close it.*"
23+
}
24+
}
25+
},
26+
{
27+
"label": "Build.Renderer",
28+
"type": "shell",
29+
"command": "npm run ng:serve",
830
"isBackground": true,
931
"group": {
1032
"kind": "build",

Diff for: README.md

+10
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ Maybe you only want to execute the application in the browser with hot reload? J
9494

9595
YES! You can do it! Just by importing your library in npm dependencies section (not **devDependencies**) with `npm install --save`. It will be loaded by electron during build phase and added to your final package. Then use your library by importing it in `main.ts` file. Quite simple, isn't it?
9696

97+
## Debug with VsCode
98+
99+
[VsCode](https://code.visualstudio.com/) debug configuration is available! In order to use it, you need the extension [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome).
100+
101+
Then set some breakpoints in your application's source code.
102+
103+
Finally from VsCode press **Ctrl+Shift+D** and select **Application Debug** and press **F5**.
104+
105+
Please note that Hot reload is only available in Renderer process.
106+
97107
## E2E Testing
98108

99109
E2E Test scripts can be found in `e2e` folder.

0 commit comments

Comments
 (0)