Debug configuration for debugging yeoman generator in vscode

42 views Asked by At

I am trying to debug a custom yeoman generator. The yeoman generator I am writing is in typescript.

The launch.json looks like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Yeoman Generator Debug",
            "type": "node",
            "request": "launch",
            "program": "${workspaceFolder}/node_modules/yo/lib/cli.js",
            "stopOnEntry": false,
            "args": [
                "yo", "adi-project"
            ],
            "cwd": "${workspaceRoot}",
            "preLaunchTask": null,
            "runtimeExecutable": null,
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "externalConsole": false,
            "sourceMaps": false,
            "outDir": null
        },
    ]
}

I see the following in the call stack: call stack here

It flashes for a few seconds and the debug session ends. When I set stopOnEntry as true it stops on the first line of cli.js.

The scripts in package.json looks like this:

"scripts": {
    "build": "tsc && yarn run copydeps && yarn run lint",
    "copydeps": "copyfiles -u 1 \"src/app/templates/**\" generators",
    "lint": "eslint --ext .js,.jsx,.ts,.tsx --ignore-path .gitignore .",
    "clean": "rimraf -rf ./generators",
    "watch": "yarn run watch-tsc --silent & yarn run watch-deps --silent",
    "watch-deps": "onchange 'src/*/templates/**' --initial -- yarn run copydeps --silent",
    "watch-tsc": "tsc-watch --onSuccess 'yarn run lint --silent'",
    "start": "yarn run build && npm link && yo adi-project"
  }

I am not sure on how to setup vscode so that I have smooth debug launch and I am bale to debug the code.

Any help will be appreciated!

0

There are 0 answers