Skip to content

Commit 2485bda

Browse files
committed
Reordering docs and updating header levels.
1 parent c932a32 commit 2485bda

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

README.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,49 +20,46 @@ The preferred method is global install but can optionally be placed locally as w
2020
```
2121

2222

23-
#### Add the reporting module to your code
23+
### Add the reporting module
2424

25-
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.
26-
27-
##### Including via preload argument
28-
29-
This pattern requires you to use a run-time flag (see below).
30-
31-
```bash
32-
% nodejs-dashboard -- node -r nodejs-dashboard index.js
33-
```
25+
There are a couple patterns for including `nodejs-dashboard` in your code. This module isn't designed for production use and should be limited to development environments.
3426

3527
##### Including via code
3628

3729
From within a `dev.index.js` script or other dev entry point simply require the `nodejs-dashboard` module.
3830

39-
```
31+
```js
32+
// dev.index.js
4033
require("nodejs-dashboard");
34+
require("./index");
4135
```
4236

43-
#### Update your package.json
44-
45-
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.
46-
47-
For example, if you want to conditionally include via requires flag see the following example.
37+
Next update your `package.json` to launch the dashboard:
4838

4939
```js
5040
...
5141
"scripts": {
52-
"dev": "nodejs-dashboard -- node -r nodejs-dashboard index.js"
42+
"dev": "nodejs-dashboard node dev.index.js"
5343
}
5444
...
5545
```
5646

57-
In this example we've included the module in a custom development entry point.
47+
##### Including via preload argument
48+
49+
This method utilizes Node's `-r` flag to introduce the `nodejs-dashboard` module. In this setup no code modifications are required. This is functionally equivalent to the above example.
50+
51+
Update your `package.json` with the new script:
52+
5853
```js
5954
...
6055
"scripts": {
61-
"dev": "nodejs-dashboard node dev.index.js"
56+
"dev": "nodejs-dashboard -- node -r nodejs-dashboard index.js"
6257
}
6358
...
6459
```
6560

61+
##### Caveats
62+
6663
If your app requires additional arguments you'll need to pass the `--` flag to your script. For example:
6764

6865
```js
@@ -82,14 +79,14 @@ Most CLI interfaces provide a mechanism for launching other tools. If you're loo
8279
```
8380

8481

85-
#### Launch your app
82+
### Launch your app
8683
Once you've completed these steps run the following in your terminal:
8784

8885
```bash
8986
% npm run dev
9087
```
9188

92-
#### What options does nodejs-dashboard support?
89+
### What options does nodejs-dashboard support?
9390

9491
Usage: nodejs-dashboard [options] -- [node] [script] [arguments]
9592
```

0 commit comments

Comments
 (0)