Documentation on how to debug locally using VS Code. (#335)

This commit is contained in:
neilsutcliffe 2017-12-20 22:16:21 +01:00 committed by Joel Marcey
parent e6a1844299
commit 93c93af40a
3 changed files with 32 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.DS_Store
.vscode
node_modules
lib/core/metadata.js

View file

@ -15,6 +15,36 @@ npm run start
> If you look in the `website/package.json` file, you will notice that running `start` with `npm run` actually executes the local `start-server.js` file. This is how you know you are running with local code.
## Debugging Locally
### VS Code
Use the following code in VSCode to enable breakpoints. Please ensure you have a later verison of node for non-legacy debugging.
```
{
"version": "0.2.0",
"configurations": [
{
"name": "Docusaurus Start (Debug)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/website",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"start-debug"
],
"port": 9229
}
]
}
```
### Other Editors
Feel free to contribute debug instructions for other IDEs
### Observing changes
Now that the server is running, you can make changes to the core Docusaurus code and docs to see the effects on the Docusaurus site. Just refresh the local site, usually running at http://localhost:3000

View file

@ -1,6 +1,7 @@
{
"scripts": {
"start": "node ../lib/start-server.js",
"start-debug": "node --inspect ../lib/start-server.js",
"build": "node ../lib/build-files.js",
"publish-gh-pages": "node ../lib/publish-gh-pages.js",
"examples": "node ../lib/copy-examples.js",