File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,13 @@ const path = require('path');
6
6
const log = new logger . getLogger ( 'ShrinkwrapValidator' ) ;
7
7
8
8
async function main ( ) {
9
+ const shrinkwrapPath = path . resolve ( 'npm-shrinkwrap.json' ) ;
10
+ if ( ! ( await fs . exists ( shrinkwrapPath ) ) ) {
11
+ log . info ( 'No shrinkwrap found. Skipping shrinkwrap check' ) ;
12
+ return ;
13
+ }
14
+ const shrinkwrap = JSON . parse ( await fs . readFile ( shrinkwrapPath ) ) ;
9
15
const backupShrinkwrap = JSON . parse ( await fs . readFile ( path . resolve ( 'npm-shrinkwrap-backup.json' ) ) ) ;
10
- const shrinkwrap = JSON . parse ( await fs . readFile ( path . resolve ( 'npm-shrinkwrap.json' ) ) ) ;
11
16
log . info ( 'Checking that pruned shrinkwrap is a subset of primary shrinkwrap' ) ;
12
17
if ( ! _ . isMatch ( backupShrinkwrap , shrinkwrap ) ) {
13
18
log . errorAndThrow ( 'Pruned shrinkwrap (shrinkwrap with dev dependencies removed) is not a subset of the original npm-shrinkwrap.json' ) ;
You can’t perform that action at this time.
0 commit comments