Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a .vscode/launch.json file to the default project template to ease out-of-the-box debugging in VSCode. #1544

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Booster App",
"type": "node-terminal",
"request": "launch",
"program": "${workspaceFolder}/src/index.ts",
"preLaunchTask": "tsc: build",
"cwd": "${workspaceFolder}",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"sourceMaps": true,
"env": {
"NODE_ENV": "development"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"skipFiles": ["<node_internals>/**"]
}
]
}
2 changes: 2 additions & 0 deletions packages/cli/src/services/project-initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as configTs from '../templates/project/config-ts'
import * as indexTs from '../templates/project/index-ts'
import * as prettierRc from '../templates/project/prettierrc-yaml'
import * as mochaRc from '../templates/project/mocharc-yml'
import * as launchJson from '../templates/project/launch-json'
import { guardError, wrapExecError } from '../common/errors'
import { PackageManagerService } from './package-manager'
import { gen, mapError, pipe, unsafeRunEffect } from '@boostercloud/framework-types/dist/effect'
Expand Down Expand Up @@ -107,4 +108,5 @@ const filesToGenerate: Array<[Array<string>, string]> = [
[['src', 'config', 'config.ts'], configTs.template],
[['src', 'index.ts'], indexTs.template],
[['.mocharc.yml'], mochaRc.template],
[['.vscode','launch.json'],launchJson.template],
]
2 changes: 2 additions & 0 deletions packages/cli/src/templates/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as GitIgnore from './gitignore'
import * as IndexTs from './index-ts'
import * as PackageJson from './package-json'
import * as TsconfigJson from './tsconfig-json'
import * as LaunchJson from './launch-json'

export const templates = {
configTs: ConfigTs.template,
Expand All @@ -12,4 +13,5 @@ export const templates = {
indexTs: IndexTs.template,
packageJson: PackageJson.template,
tsconfigJson: TsconfigJson.template,
launchJson: LaunchJson.template,
}
13 changes: 13 additions & 0 deletions packages/cli/src/templates/project/launch-json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const template = '{
"version": "0.2.0",
"configurations": [
// Runs npx boost -e local
{
"command": "npm run build && npx boost start -e local",
"name": "Start Debug Server",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}"
},
]
}'
Loading