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
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

javiertoledo marked this conversation as resolved.
Show resolved Hide resolved
{
"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>/**"]
}
]
}
1 change: 1 addition & 0 deletions packages/cli/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

javiertoledo marked this conversation as resolved.
Show resolved Hide resolved
{
"command": "rushx test",
"name": "Unit Tests",
Expand Down
3 changes: 3 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 @@ -53,6 +54,7 @@ export async function generateRootDirectory(config: ProjectInitializerConfig): P
[srcDir, 'event-handlers'],
[srcDir, 'read-models'],
[srcDir, 'scheduled-commands'],

javiertoledo marked this conversation as resolved.
Show resolved Hide resolved
]
await Promise.all(dirs.map(createDirectory))
}
Expand Down Expand Up @@ -107,4 +109,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,
}
14 changes: 14 additions & 0 deletions packages/cli/src/templates/project/launch-json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

javiertoledo marked this conversation as resolved.
Show resolved Hide resolved
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