@@ -9,17 +9,15 @@ const walkModules = ((path = 'node_modules') => {
9
9
dirTree ( path , { extensions :/ \. j s o n $ / } , ( item ) => {
10
10
11
11
if ( item . name === 'package.json' ) {
12
- try {
13
- let pkg = JSON . parse ( fs . readFileSync ( item . path , 'utf8' ) ) ;
14
- if ( ! pkg || ! pkg . scripts ) return ;
15
- let scripts = Object . keys ( pkg . scripts ) ;
16
- scripts . forEach ( ( script ) => {
17
- if ( scriptTypes . includes ( script ) ) {
18
- reports . push ( { name : pkg . name , script : script , src :item . path } )
19
- }
20
- } ) ;
21
- catch ( e ) {
22
- }
12
+ let pkg = JSON . parse ( fs . readFileSync ( item . path , 'utf8' ) ) ;
13
+ if ( ! pkg . scripts ) return ;
14
+ let scripts = Object . keys ( pkg . scripts ) ;
15
+ scripts . forEach ( ( script ) => {
16
+ if ( scriptTypes . includes ( script ) ) {
17
+ reports . push ( { name : pkg . name , script : script } )
18
+ }
19
+ } ) ;
20
+
23
21
}
24
22
25
23
} ) ;
@@ -32,7 +30,7 @@ process.on('exit', () => {
32
30
} else {
33
31
console . log ( '\x1b[31m' , 'Potentially unsafe scripts found. These should be reviewed for safety' , '\x1b[0m' ) ;
34
32
reports . forEach ( ( report ) => {
35
- console . log ( `Module name: ${ report . name } Type: ${ report . script } Src: ${ report . src } ` ) ;
33
+ console . log ( `Module name: ${ report . name } Type: ${ report . script } ` ) ;
36
34
} ) ;
37
35
}
38
36
0 commit comments