Skip to content

How to Debug Upendo DNN Generator

Will Strohl edited this page Aug 1, 2023 · 1 revision

If you're working on the Upendo DNN Generator, you may find yourself wanting to debug certain workflows or use cases. When this is the case, in addition to the Yeoman debugging method, you really have two options.

Option 1: Do it the Old School Way

Do you remember before we had all of these shiny toolkits and browser tools to help us write client-side code? Well, it doesn't matter if you don't.

When you want to debug something quickly, you can simply emit some text values and/or forced error messages to provide more information.

Then, run the code to see those values. Remove them, then debug the next thing.

This is quick, easy, and effective. However, please remember to remove your debugging statements. :)

Option 2: Run the Debugger

Now, if you want a more comprehensive debugging experience, this project supports that too!

  1. Open the source code using Visual Studio Code.
  2. In VS Code, click on the Run and Debug section.

image

  1. Click on the create a launch.json file link.

image

  1. Update the new launch.json file with the code below:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug upendodnn",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/node_modules/yo/lib/cli.js",
            "args": [
              "upendodnn",
              "--skip-install"
            ],
            "cwd": "<your work dir>",
            "console": "externalTerminal",
            "internalConsoleOptions": "neverOpen",
            "stopOnEntry": false
          }
    ]
}
  1. Replace <your work dir> with the root directory of where the solution structure was created using Upendo DNN Generator.
  2. Run the code and enjoy your debugging experience!

References: