A linter for package locks.
npm i -D @netatwork/check-npm-dependencies
// package.json
{
...
"nawCheckNpmDependencies": {
"extends": "./some-shared-config.json",
"noDuplicates": [
"@example/*"
],
"sameVersions": [
"@example/*",
[
"example-a-*",
"example-b"
]
]
}
}
- nawCheckNpmDependencies
<Config>
- Can be a path to load the config from or an object with the following options:- extends
<string>
- A path to load a config from to extend. - noDuplicates
<string[]>
- An array of package name patterns to check for duplicates.- In the example above, all packages within the
@example
scope are checked for duplicates.
- In the example above, all packages within the
- sameVersions
<(string | string[])[]>
- An array of patterns or pattern groups to ensure that all packages within a group have the same versions.- In the example above, all packages within the
@example
scope are checked for the same version andexample-a-*
andexample-b
are checked for the same version.
- In the example above, all packages within the
- extends
# Run via npx:
npx naw-check-npm-dependencies [...args]
// Or add to your package.json:
{
"scripts": {
"test": "naw-check-npm-dependencies ..."
}
}
--context | -c <path>
- The path at which to look for apackage.json
andpackage-lock.json
.