diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ae3d50 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +/node_modules \ No newline at end of file diff --git a/README.md b/README.md index eb036f2..6363475 100644 --- a/README.md +++ b/README.md @@ -15,27 +15,26 @@ Tool for getting node-inspector working on windows and for simplifying the proce - Windows - [Latest npm build for windows] (http://npmjs.org/doc/README.html#Installing-on-Windows-Experimental) - **Installation** - From the command window launch install.cmd. This will install node-inspector via npm and apply the paperboy patch described [here] (https://github.com/dannycoates/node-inspector/issues/62#issuecomment-1998429) to get node-inspector working on windows. - From the start menu right click on Computer->Properties->Advanced Computer Settings->Environment variables. - Create 2 system variables - set NODE_INSPECTOR to the folder where this repo is located i.e. "c:\node-inspector" - - set NODE_INSPECTOR_BROWSER to the path of your webkit browser of choice i.e. Chrome, Safari. For example right clicking on Chrome on my machine gives me “C:\Users\gblock\AppData\Local\Google\Chrome\Application\chrome.exe” - Add %NODE_INSPECTOR% to your path. **Using** +- node-debug [-c] [-p PORT] + -c will run coffee app.coffee in debug mode otherwise + -p will start node-inspector on the provided port. - In the command window, go to the folder where the node app you want to debug is. -- Type node-debug [url] e.g. node-debug http://localhost:3000 +- Type node-debug Once you run it from the app folder it will: - Launch node inspector -- Launch you app in debug mode. -- Open the browser you specified and launch the debugger ui. -- Launch the start url you specified. +- Launch your app in debug mode. (either through `node` or `coffee` depending on the `-c` switch) **Known issues** I've seen some cases where running node-debug causes a socket error. This seems to happen periodically. Closing the command windows and starting again seems to clear it. diff --git a/environmentvars.bat b/environmentvars.bat index 922859a..3d5f5ac 100644 --- a/environmentvars.bat +++ b/environmentvars.bat @@ -1,2 +1,2 @@ -REM Set environment variables here -REM example: SET MY_VARIABLE=MY_VALUE \ No newline at end of file +@REM Set environment variables here +@REM example: SET MY_VARIABLE=MY_VALUE \ No newline at end of file diff --git a/node-debug.cmd b/node-debug.cmd index dd529ac..5147683 100644 --- a/node-debug.cmd +++ b/node-debug.cmd @@ -1,11 +1,35 @@ -@echo off -start "" "cmd" "/k cd %NODE_INSPECTOR%\node_modules\node-inspector\bin&&node inspector &" +@ECHO off +SET PORT=8080 +SET COFFEEDEBUG=0 +SET RUNENVBAT=0 +IF EXIST "%NODE_INSPECTOR%\environmentvars.bat" SET RUNENVBAT=1 -if exist "%NODE_INSPECTOR%\environmentvars.bat" ( - start "" "cmd" "/k %NODE_INSPECTOR%\environmentvars.bat&&node --debug-brk app.js" -) else ( - start "" "cmd" "/k node --debug-brk app.js" -) +IF "%1"=="" GOTO APPSTART +:GETOPTS + IF /I %1 == -c SET COFFEEDEBUG=1& + IF /I %1 == -p SET PORT=%2& SHIFT + SHIFT +IF NOT (%1)==() GOTO GETOPTS + +:APPSTART -start "" %NODE_INSPECTOR_BROWSER% "http://localhost:8080" -echo start "" %NODE_INSPECTOR_BROWSER% "%1%" \ No newline at end of file +START "" "cmd" "/k cd %NODE_INSPECTOR%\node_modules\node-inspector\bin&&node inspector --web-port=%PORT%&" +ECHO started node-inspector on port:%PORT% +IF %COFFEEDEBUG% == 1 IF %RUNENVBAT% == 1 ( + START "" "cmd" "/k %NODE_INSPECTOR%\environmentvars.bat&&coffee --nodejs --debug app.coffee" + ECHO applied environmentvars.bat + ECHO started coffee --nodejs --debug app.coffee +) +IF %COFFEEDEBUG% == 1 IF %RUNENVBAT% == 0 ( + START "" "cmd" "/k coffee --nodejs --debug app.coffee" + ECHO started coffee --nodejs --debug app.coffee +) +IF %COFFEEDEBUG% == 0 IF %RUNENVBAT% == 1 ( + START "" "cmd" "/k %NODE_INSPECTOR%\environmentvars.bat&&node --debug-brk app.js" + ECHO applied environmentvars.bat + ECHO started node --debug-brk app.js +) +IF %COFFEEDEBUG% == 0 IF %RUNENVBAT% == 0 ( + START "" "cmd" "/k node --debug-brk app.js" + ECHO started node +)