From 93c93af40a35ef82385d6175c66324ef5bde317d Mon Sep 17 00:00:00 2001 From: neilsutcliffe Date: Wed, 20 Dec 2017 22:16:21 +0100 Subject: [PATCH] Documentation on how to debug locally using VS Code. (#335) --- .gitignore | 1 + admin/testing-changes-on-Docusaurus-itself.md | 30 +++++++++++++++++++ website/package.json | 1 + 3 files changed, 32 insertions(+) diff --git a/.gitignore b/.gitignore index dcd5aa66a0..045af5090c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.vscode node_modules lib/core/metadata.js diff --git a/admin/testing-changes-on-Docusaurus-itself.md b/admin/testing-changes-on-Docusaurus-itself.md index a284a61505..d692f4ecb1 100644 --- a/admin/testing-changes-on-Docusaurus-itself.md +++ b/admin/testing-changes-on-Docusaurus-itself.md @@ -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 diff --git a/website/package.json b/website/package.json index 45a6f212b2..1067e81f4c 100644 --- a/website/package.json +++ b/website/package.json @@ -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",