Socket
Book a DemoInstallSign in
Socket

check-dependency-lists

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-dependency-lists

Check dependency lists are all in sync

2.0.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Check Dependency Lists

Build Status npm version Dependency Status devDependency Status

Check dependency lists are all in sync. This script checks the package.json file against both the installed dependencies and the npm-shrinkwrap.json file to make sure that they are all in sync and that all dependencies match the expected version ranges.

Options

The function takes an options object which can contain

  • rootDir - a relative path to the roo of the project; this should be the location of your package.json and npm-shrinkwrap.json files.
  • callback - A function to be called once the check is complete. An error will be provided as the only parameter if dependency mismatches are detected.
    • If the callback is not provided, an exception will be thrown on mismatch.

Example

The check can be run using the example directory.

For example, if lodash were installed without being saved to the package.json file or shrinkwrapped, the following output would be produced.

> $ node example

There are dependencies which are not present in all dependency lists
[
    {
        "name": "lodash",
        "presence": {
            "packagejson": false,
            "npmshrinkwrap": false,
            "installed": true
        },
        "version": {
            "packagejson": null,
            "npmshrinkwrap": null,
            "installed": "3.10.1"
        }
    }
]
[Error: Dependency check failed]

Adding as a linting task

This check can been added as part of your build or linting tasks to cause a failure when dependencies are not in sync.

var checkDependencyLists = require('check-dependency-lists');

gulp.task('dependency-lint', function() {
  return checkDependencyLists({
    rootDir: '../'
  });
});

Keywords

gulp

FAQs

Package last updated on 15 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.