misc/ vscode debug

This commit is contained in:
Maxime GRIS
2021-03-26 18:53:45 +01:00
parent 54a42eb1e5
commit f4225a3ec1
3 changed files with 59 additions and 17 deletions

40
.vscode/launch.json vendored
View File

@@ -5,32 +5,42 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Electron Main Renderer", "name": "Renderer",
"type": "chrome",
"request": "attach",
"port": 9876,
"url": "http://localhost:4200",
"sourceMaps": true,
"timeout": 10000,
"trace": "verbose",
"sourceMapPathOverrides": {
"webpack:///./*": "${workspaceFolder}/*"
},
"preLaunchTask": "Build.Renderer"
},
{
"name": "Main",
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"protocol": "inspector", "protocol": "inspector",
// Prelaunch task compiles main.ts for Electron & starts Angular dev server.
"preLaunchTask": "Build.All",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"trace": "verbose",
"runtimeArgs": [ "runtimeArgs": [
"--serve", "--serve",
".", ".",
"--remote-debugging-port=9222" "--remote-debugging-port=9876"
], ],
"windows": { "windows": {
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd" "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
} },
}, { "preLaunchTask": "Build.Main"
"name": "Karma Attach Chrome", }
"type": "chrome", ],
"request": "attach", "compounds": [
"port": 9222, {
"webRoot": "${workspaceFolder}/", "name": "Application Debug",
"sourceMaps": true, "configurations": [ "Renderer", "Main" ]
"timeout": 30000,
"trace": true
} }
] ]
} }

26
.vscode/tasks.json vendored
View File

@@ -2,9 +2,31 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "Build.All", "label": "Build.Main",
"type": "shell", "type": "shell",
"command": "npm run electron:serve-tsc && ng serve", "command": "npm run electron:serve-tsc",
"isBackground": false,
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "typescript",
"source": "ts",
"applyTo": "closedDocuments",
"fileLocation": ["relative", "${cwd}"],
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": "^.*",
"endsPattern": "^.*Terminal will be reused by tasks, press any key to close it.*"
}
}
},
{
"label": "Build.Renderer",
"type": "shell",
"command": "npm run ng:serve",
"isBackground": true, "isBackground": true,
"group": { "group": {
"kind": "build", "kind": "build",

View File

@@ -94,6 +94,16 @@ Maybe you only want to execute the application in the browser with hot reload? J
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? 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?
## Debug with VsCode
[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).
Then set some breakpoints in your application's source code.
Finally from VsCode press **Ctrl+Shift+D** and select **Application Debug** and press **F5**.
Please note that Hot reload is only available in Renderer process.
## E2E Testing ## E2E Testing
E2E Test scripts can be found in `e2e` folder. E2E Test scripts can be found in `e2e` folder.