Socket
Socket
Sign inDemoInstall

check-packages

Package Overview
Dependencies
155
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    check-packages

CLI tool to check your npm dependencies against a list of allowed/forbidden packages.


Version published
Weekly downloads
1.8K
decreased by-41%
Maintainers
3
Install size
2.98 MB
Created
Weekly downloads
 

Readme

Source

npm version Dependency Status devDependency Status Build Status Coverage

check-packages

CLI tool to check your npm dependencies against a list of allowed/forbidden packages.

Install

To use it in your project:

$ npm install --save-dev check-packages

To use it globally:

$ npm install --global check-packages

It requires Node.js (v6 or higher).

Usage

$ check-packages <checklist.json> [options]

Checklist JSON File

The content of the checklist file must be an array of package names (with optional semver ranges), e.g.:

[
  "react",
  "react-dom",
  "redux@>=1.0.0-rc.0 <1.0.1",
  "react-redux@^2 <2.2 || > 2.3"
]

By default check-packages uses the checklist path packages-whitelist.json (respectively packages-blacklist.json when called with option --blacklist), but you can also call check-packages with a different checklist path as first argument, e.g.:

$ check-packages "./config/whitelisted-dev-dependencies.json" --dev

Options

OptionAliasDescription
topLevelOnlyChecks only direct dependencies listed in the top level package.json (equivalent to depth=0).
Note: You cannot use topLevelOnly together with depth.
depthMax depth of the dependency tree analysis (default: inifity).
Note: You cannot use depth together with topLevelOnly.
blacklistblackInterpret content of checklist as blacklist.
developmentdevAnalyze the dependency tree for devDependencies.
productionprodAnalyze the dependency tree for dependencies.
verboseLists unallowed dependencies.
exitCodeExit code in case of unallowed dependencies. Default: 1
versionvDisplays the version number.
helphDisplays the help.

Examples

$ check-packages
$ check-packages --blacklist
$ check-packages my-whitelist.json --dev --depth=10
$ check-packages my-whitelist.json --dev --topLevelOnly --verbose
$ check-packages my-blacklist.json --prod --blacklist

License

MIT © Christian Kühl

Keywords

FAQs

Last updated on 25 Mar 2022

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc