From f8141a0b0640a9b785a7ee4deb91bf493478fd7d Mon Sep 17 00:00:00 2001 From: ThanhTDT Date: Thu, 27 Jul 2017 21:09:17 +0700 Subject: [PATCH] add attach debug configuration - Attach debug configuration - Scripts: debug, serve-debug, watch-debug - Readme --- .vscode/launch.json | 6 ++++++ README.md | 5 +++++ package-lock.json | 1 - package.json | 7 +++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 5d2b807..562a946 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,12 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "type": "node", + "request": "attach", + "name": "Attach", + "port": 9229 + }, { "type": "node", "request": "launch", diff --git a/README.md b/README.md index 2b7efb0..db85a4c 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,11 @@ Now just set your breakpoints and go! VS Code will try to launch on the same port and error out. Likewise be sure to stop the debugger before returning to your normal `npm start` process. +#### Using attach debug configuration +VS Code debuggers also support attaching to an already running program. The `Attach` configuration has already configured, everything you need to do is change `Debug Configuration` to `Attach` and hit `F5`. + +> Tip! Instead of running `npm start`, using `npm run debug` and `Attach Configuration` that make you don't need to stop running project. + ## Testing For this project, I chose [Jest](https://facebook.github.io/jest/) as our test framework. While Mocha is probably more common, Mocha seems to be looking for a new maintainer and setting up TypeScript testing in Jest is wicked simple. diff --git a/package-lock.json b/package-lock.json index 1b93be4..84dcc07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,7 +2,6 @@ "name": "express-typescript-starter", "version": "0.1.0", "lockfileVersion": 1, - "requires": true, "dependencies": { "@types/async": { "version": "2.0.40", diff --git a/package.json b/package.json index 5aaa1e2..c90faec 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,10 @@ "build-sass": "node-sass src/public/css/main.scss dist/public/css/main.css", "watch-sass": "node-sass -w src/public/css/main.scss dist/public/css/main.css", "tslint": "tslint -c tslint.json -p tsconfig.json", - "copy-static-assets": "node copyStaticAssets.js" + "copy-static-assets": "node copyStaticAssets.js", + "debug": "npm run build && npm run watch-debug", + "serve-debug": "nodemon --inspect dist/server.js", + "watch-debug": "concurrently -k -p \"[{name}]\" -n \"Sass,TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-sass\" \"npm run watch-ts\" \"npm run serve-debug\"" }, "jest": { "globals": { @@ -93,4 +96,4 @@ "tslint": "^5.0.0", "typescript": "^2.4.0" } -} +} \ No newline at end of file