node/deps/npm/node_modules/lock-verify
Kat Marchán 033f6b566e
deps: upgrade npm to 6.9.0
Co-authored-by: Myles Borins <mylesborins@google.com>

PR-URL: https://github.com/nodejs/node/pull/26244
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-06 20:56:17 -04:00
..
index.js deps: upgrade npm to 6.9.0 2019-04-06 20:56:17 -04:00
LICENSE deps: upgrade npm to 6.1.0 2018-05-24 23:24:45 -07:00
package.json deps: upgrade npm to 6.9.0 2019-04-06 20:56:17 -04:00
README.md deps: upgrade npm to 6.1.0 2018-05-24 23:24:45 -07:00

lock-verify

Report if your package.json is out of sync with your package-lock.json.

USAGE

const lockVerify = require('lock-verify')
lockVerify(moduleDir).then(result => {
  result.warnings.forEach(w => console.error('Warning:', w))
  if (!result.status) {
    result.errors.forEach(e => console.error(e))
    process.exit(1)
  }
})

As a library it's a function that takes the path to a module and returns a promise that resolves to an object with .status, .warnings and .errors properties. The first will be true if everything was ok (though warnings may exist). If there's no package.json or no lockfile in moduleDir or they're unreadable then the promise will be rejected.