add vscode launch config for debugging inso (#4161)

* add vscode launch config for debugging inso

* remove undeclared task
This commit is contained in:
James Gatz 2021-11-01 16:13:30 +01:00 committed by GitHub
parent 8918b15113
commit 9bfbd5c6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 114 additions and 4 deletions

54
.vscode/launch.json vendored
View File

@ -46,6 +46,56 @@
},
"webRoot": "${workspaceFolder}/packages/insomnia-app/app",
"timeout": 60000
},
{
"type": "node",
"request": "launch",
"protocol": "inspector",
"smartStep": true,
"name": "Inso",
"cwd": "${workspaceFolder}/packages/insomnia-inso",
"program": "${workspaceFolder}/packages/insomnia-inso/bin/debug_inso",
"sourceMaps": true,
"autoAttachChildProcesses": true,
"trace": true,
"preLaunchTask": "Inso: Compile (Watch)",
"sourceMapPathOverrides": {
"webpack://insomniacli/./*": "${workspaceFolder}/packages/insomnia-inso/*"
},
"args": ["${input:insoCommand}", "${input:insoCommandArgs}"],
"console": "integratedTerminal"
}
],
"inputs": [
{
"id": "insoCommandArgs",
"description": "Add an additional argument to inso",
"type": "promptString"
},
{
"id": "insoCommand",
"description": "Pick an inso command to run",
"type": "pickString",
"options": [
{
"value": "generate config"
},
{
"value": "run test"
},
{
"value": "lint spec"
},
{
"value": "export spec"
},
{
"value": "script"
},
{
"value": "help"
},
]
}
],
"compounds": [
@ -59,8 +109,8 @@
"preLaunchTask": "Insomnia: Compile (Watch)",
"configurations": [
"Electron: main",
"Electron: renderer",
],
"Electron: renderer"
]
}
]
}

46
.vscode/tasks.json vendored
View File

@ -51,7 +51,7 @@
"endsPattern": {
"regexp": "Compiled"
}
},
}
},
"command": "${workspaceRoot}/packages/insomnia-app/node_modules/.bin/webpack-dev-server --config webpack/webpack.config.development.ts"
},
@ -60,8 +60,50 @@
"detail": "Compile Renderer (Watch) | Compile Main",
"dependsOn": [
"Insomnia: Compile Renderer (Watch)",
"Insomnia: Compile Main",
"Insomnia: Compile Main"
]
},
{
"label": "Inso: Compile (Watch)",
"detail": "npm start",
"type": "shell",
"promptOnClose": false,
"isBackground": true,
"problemMatcher": {
"owner": "webpack",
"severity": "error",
"fileLocation": "absolute",
"pattern": [
{
"regexp": "ERROR in (.*)",
"file": 1
},
{
"regexp": "\\((\\d+),(\\d+)\\):(.*)",
"line": 1,
"column": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "watching"
},
"endsPattern": {
"regexp": "Built at\\:"
}
}
},
"command": "npm run inso-start"
}
],
"inputs": [
{
"id": "inso_args",
"type": "promptString",
"description": "Arguments to pass to inso",
"default": "-v"
}
]
}

View File

@ -0,0 +1,17 @@
#!/usr/bin/env node
/**
* This file is only used by the vscode launch config.
* It allows us to provide a free text prompt to the user to pass any inso extra arguments.
* https://github.com/microsoft/vscode/issues/83678
*/
let args = process.argv;
if (args.length >= 2 && require('inspector').url()) {
args = process.argv.reduce((allArgs, arg) => [...allArgs, ...arg.split(/\s/)], []);
}
// This should always be the same as bin/inso
global.require = require;
const insomniacli = require('../dist/index.js');
insomniacli.go(args);

View File

@ -5,6 +5,7 @@ const base = require('./webpack.config.base');
/** @type { import('webpack').Configuration } */
module.exports = merge(base, {
mode: 'development',
devtool: 'inline-source-map',
plugins: [
new webpack.DefinePlugin({
__DEV__: true,