Skip to content

Commit 2862a8e

Browse files
committed
Update readme
1 parent 8a3d7e9 commit 2862a8e

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

README.md

+17-11
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,32 @@ Parse a given `npm` script command from `package.json` & return information.
77
- & What the final command run is
88

99
Useful for parsing dependencies actually used and figuring out wtf is happening in a complex `package.json`.
10+
It supports extracting values from npm-run-all.
1011

1112
## Usage
1213

1314
```js
14-
const path = require('path')
15-
const util = require('util')
16-
const parse = require('./lib')
15+
const path = require("path");
16+
const util = require("util");
17+
const parse = require("@netlify/parse-npm-script");
18+
const { readFileSync } = require("fs-extra");
1719

18-
/* path to your package.json file */
19-
const packagePath = path.join(__dirname, 'tests/fixtures/one.json')
20+
/* your package.json file */
21+
const packageJSON = readFileSync(
22+
path.join(__dirname, "tests/fixtures/one.json")
23+
);
2024

2125
async function runParser() {
22-
const parsed = await parse(packagePath, 'npm run build')
23-
console.log(util.inspect(parsed, {
24-
showHidden: false,
25-
depth: null
26-
}))
26+
const parsed = await parse(packageJSON, "npm run build");
27+
console.log(
28+
util.inspect(parsed, {
29+
showHidden: false,
30+
depth: null,
31+
})
32+
);
2733
}
2834

29-
runParser()
35+
runParser();
3036

3137
/* Parsed contents
3238
{

0 commit comments

Comments
 (0)