assert-package-lock-is-consistent
v1.0.0
Published
Assert that package-lock.json is consistent with package.json
Maintainers
Readme
assert-package-lock-is-consistent
Assert that package-lock.json is consistent with package.json, that is,
both files have the same dependencies.
Install
Requires node@14 or higher:
npm install assert-package-lock-is-consistent --save-devUsage
This package verifies that package-lock.json and package.json files in your project
have the same dependencies (dependencies, devDependencies, peerDependencies, and
optionalDependencies).
If some dependency exists only in one file, or if the versions of some dependency
in these files are different, the package throws an exception with a list of all such differences
(prints a list and returns code 1 in CLI).
Dependency versions may difference if someone, for example, forgets to update package-lock.json
file or include it in a commit.
The package works with package-lock.json file version 2 (npm@7 or higher).
CLI
Assert that package-lock.json has the same dependencies as package.json:
npx assert-package-lock-is-consistentJavaScript/TypeScript API
import assertPackageLockIsConsistent from 'assert-package-lock-is-consistent';
// or
import {assertPackageLockIsConsistent} from 'assert-package-lock-is-consistent';
// assert that package-lock.json has the same dependencies as package.json
assertPackageLockIsConsistent();