File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const audit = require('./install/audit.js')
55const npm = require ( './npm.js' )
66const log = require ( 'npmlog' )
77const parseJson = require ( 'json-parse-better-errors' )
8+ const lockVerify = require ( 'lock-verify' )
89
910const readFile = Bluebird . promisify ( fs . readFile )
1011
@@ -66,7 +67,15 @@ function auditCmd (args, cb) {
6667 ( pkgJson && pkgJson . dependencies ) || { } ,
6768 ( pkgJson && pkgJson . devDependencies ) || { }
6869 )
69- return audit . generate ( sw , requires )
70+ return lockVerify ( npm . prefix ) . then ( ( result ) => {
71+ if ( result . status ) return audit . generate ( sw , requires )
72+
73+ const lockFile = shrinkwrap ? 'npm-shrinkwrap.json' : 'package-lock.json'
74+ const err = new Error ( `Errors were found in your ${ lockFile } , run npm install to fix them.\n ` +
75+ result . errors . join ( '\n ' ) )
76+ err . code = 'ELOCKVERIFY'
77+ throw err
78+ } )
7079 } ) . then ( ( auditReport ) => {
7180 return audit . submitForFullReport ( auditReport )
7281 } ) . catch ( ( err ) => {
You can’t perform that action at this time.
0 commit comments