File tree 1 file changed +17
-11
lines changed
1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -7,26 +7,32 @@ Parse a given `npm` script command from `package.json` & return information.
7
7
- & What the final command run is
8
8
9
9
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.
10
11
11
12
## Usage
12
13
13
14
``` 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" );
17
19
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
+ );
20
24
21
25
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
+ );
27
33
}
28
34
29
- runParser ()
35
+ runParser ();
30
36
31
37
/* Parsed contents
32
38
{
You can’t perform that action at this time.
0 commit comments