Skip to content

Commit c9fd55f

Browse files
committed
Updating docs for global install usage
1 parent 53e22e9 commit c9fd55f

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,50 @@
1010

1111
Determine in realtime what's happening inside your node process from the terminal. No need to instrument code to get the deets. Also splits stderr/stdout to help spot errors sooner.
1212

13+
## Getting Started
14+
1315
### Install
16+
The preferred method is global install but can optionally be placed locally as well.
17+
18+
`npm install -g nodejs-dashboard`
1419

15-
`npm install nodejs-dashboard --save-dev`
1620

1721
#### Add the reporting module to your code
1822

19-
From within your `index.js` or app entry point simply require the `nodejs-dashboard` module.
23+
There are a couple patterns for including `nodejs-dashboard` in your code. Since this module isn't designed for production use it's best to conditionally include.
24+
25+
##### Including via preload argument
26+
27+
This pattern requires you to use a run-time flag (see below).
28+
29+
`nodejs-dashboard -- node -r nodejs-dashboard index.js`
30+
31+
##### Including via code
32+
33+
From within a `dev.index.js` script or other dev entry point simply require the `nodejs-dashboard` module.
2034

2135
```
2236
require("nodejs-dashboard");
2337
```
2438

2539
#### Update your package.json
2640

27-
It's recommended that you create a npm script to launch the dashboard.
41+
It's recommended that you create a npm script to launch the dashboard. How you decide to include the module will dictate the run script.
42+
43+
For example, if you want to conditionally include via requires flag see the following example.
44+
```
45+
...
46+
"scripts": {
47+
"dev": "nodejs-dashboard -- node -r nodejs-dashboard index.js"
48+
}
49+
...
50+
```
2851

52+
In this example we've included the module in a custom development entry point.
2953
```
3054
...
3155
"scripts": {
32-
"dev": "nodejs-dashboard node index.js"
56+
"dev": "nodejs-dashboard node dev.index.js"
3357
}
3458
...
3559
```
@@ -39,14 +63,14 @@ If your app requires additional arguments you'll need to pass the `--` flag to y
3963
```
4064
...
4165
"scripts": {
42-
"dev": "nodejs-dashboard -- node -myFlag=false --bar=true index.js"
66+
"dev": "nodejs-dashboard -- node -m=false --bar=true index.js"
4367
}
4468
...
4569
```
4670

4771
##### But I want to use something else to launch my app!
4872

49-
Most CLI interfaces provide a mechanism for launching other tools. If you're looking to use something like [nodemon](https://github.com/remy/nodemon) or [babel](https://github.com/babel/babel/tree/master/packages/babel-cli) checkout the exec options provided by the cli.
73+
Most CLI interfaces provide a mechanism for launching other tools. If you're looking to use something like [nodemon](https://github.com/remy/nodemon) or [babel](https://github.com/babel/babel/tree/master/packages/babel-cli) checkout the exec options provided by the CLI.
5074

5175
`nodemon --exec "nodejs-dashboard babel-node" src/index.js`
5276

0 commit comments

Comments
 (0)