All Projects → dependency-check-team → Dependency Check

dependency-check-team / Dependency Check

checks which modules you have used in your code and then makes sure they are listed as dependencies in your package.json

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Dependency Check

Renovate
Universal dependency update tool that fits into your workflows.
Stars: ✭ 6,700 (+1440.23%)
Mutual labels:  dependencies, npm
Npm Consider
Check package dependencies before installing it
Stars: ✭ 386 (-11.26%)
Mutual labels:  dependencies, npm
Npm Gui
Graphic tool for managing javascript project dependencies - in a friendly way.
Stars: ✭ 454 (+4.37%)
Mutual labels:  dependencies, npm
Dependency Land
Find the npm modules that depend on a specific module and semver range.
Stars: ✭ 34 (-92.18%)
Mutual labels:  dependencies, npm
Dependency spy
Find known vulnerabilities in your dependencies
Stars: ✭ 87 (-80%)
Mutual labels:  dependencies, npm
Yalc
Work with yarn/npm packages locally like a boss.
Stars: ✭ 3,155 (+625.29%)
Mutual labels:  dependencies, npm
Greenkeeper
🤖 🌴 Real-time automated dependency updates for npm and GitHub
Stars: ✭ 1,564 (+259.54%)
Mutual labels:  dependencies, npm
Syncpack
Manage multiple package.json files, such as in Lerna Monorepos and Yarn/Pnpm Workspaces
Stars: ✭ 356 (-18.16%)
Mutual labels:  dependencies, npm
Stmux
Simple Terminal Multiplexer for Node.js Environments
Stars: ✭ 388 (-10.8%)
Mutual labels:  npm
Release It
🚀 Automate versioning and package publishing
Stars: ✭ 4,773 (+997.24%)
Mutual labels:  npm
Detective
Find all calls to require() no matter how deeply nested using a proper walk of the AST
Stars: ✭ 387 (-11.03%)
Mutual labels:  dependencies
Benchmarks Of Javascript Package Managers
Benchmarks of JavaScript Package Managers
Stars: ✭ 388 (-10.8%)
Mutual labels:  npm
Strongbox
Strongbox is an artifact repository manager.
Stars: ✭ 412 (-5.29%)
Mutual labels:  npm
Rfcs
Public change requests/proposals & ideation
Stars: ✭ 428 (-1.61%)
Mutual labels:  npm
Jsdelivr
A free, fast, and reliable Open Source CDN for npm, GitHub, Javascript, and ESM
Stars: ✭ 4,052 (+831.49%)
Mutual labels:  npm
Awesome Npm
Awesome npm resources and tips
Stars: ✭ 3,894 (+795.17%)
Mutual labels:  npm
Npkill
List any node_modules directories in your system, as well as the space they take up. You can then select which ones you want to erase to free up space.
Stars: ✭ 5,325 (+1124.14%)
Mutual labels:  npm
Node Thermal Printer
This npm package was made to control epson and star thermal printers
Stars: ✭ 424 (-2.53%)
Mutual labels:  npm
Disposable
A list of disposable/temporary email address domains
Stars: ✭ 407 (-6.44%)
Mutual labels:  npm
Esm.sh
A fast, global content delivery network for ES Modules.
Stars: ✭ 404 (-7.13%)
Mutual labels:  npm

dependency-check

checks which modules you have used in your code and then makes sure they are listed as dependencies in your package.json, or vice-versa

Node CI Static code analysis dependencies Status Known Vulnerabilities

js-standard-style

requirements for maintained majors

dependency-check 5.x supports Node.js 12 and later

dependency-check 4.x supports Node.js 10 and later

dependency-check 3.x supports Node.js 6 and later

dependency-check 2.x supports Node.js 0.10 and later (Dev note: published using the legacy tag)

For more info on maintenance status, see SECURITY.md.

how it works

dependency-check parses your module code starting from the default entry files (e.g. index.js or main and any bin commands defined in package.json or if specific files has been defined, then those) and traverses through all relatively required JS files, ultimately producing a list of non-relative modules

  • relative - e.g. require('./a-relative-file.js'), if one of these are encountered the required file will be recursively parsed by the dependency-check algorithm
  • non-relative - e.g. require('a-module'), if one of these are encountered it will get added to the list of dependencies, but sub-dependencies of the module will not get recursively parsed

the goal of this module is to simply check that all non-relative modules that get require()'d are in package.json, which prevents people from getting 'module not found' errors when they install your module that has missing deps which was accidentally published to NPM (happened to me all the time, hence the impetus to write this module).

cli usage

$ npm install dependency-check -g
$ dependency-check <path to module file(s), package.json or module folder>

# e.g.

$ dependency-check ./package.json --verbose
Success! All dependencies used in the code are listed in package.json
Success! All dependencies in package.json are used in the code
$ dependency-check ./package.json --missing --verbose
Success! All dependencies used in the code are listed in package.json
$ dependency-check ./package.json --unused --verbose
Success! All dependencies in package.json are used in the code

# or with file input instead:

$ dependency-check ./index.js

# even with globs and multiple inputs:

$ dependency-check ./test/**/*.js ./lib/*.js

dependency-check exits with code 1 if there are discrepancies, in addition to printing them out

To always exit with code 0 pass --ignore

--missing

running dependency-check ./package.json --missing will only do the check to make sure that all modules in your code are listed in your package.json

--unused

running dependency-check ./package.json --unused will only do the inverse of the missing check and will tell you which modules in your package.json dependencies were not used in your code

--no-dev

running dependency-check ./package.json --unused --no-dev will not tell you if any devDependencies in your package.json were missing or unused

--no-peer

running dependency-check ./package.json --unused --no-peer will not tell you if any peerDependencies in your package.json were missing or unused

--ignore-module, -i

ignores a module. This works for both --unused and --missing. You can specify as many separate --ignore-module arguments as you want. For example running dependency-check ./package.json --unused --ignore-module foo will not tell you if the foo module was not used in your code. Supports globbing patterns through the use of micromatch, so eg. --ignore-module "@types/*" is possible

--no-default-entries

running eg. dependency-check package.json tests.js --no-default-entries won't add any default entries despite the main path given being one to a package.json or module folder. So only the tests.js file will be checked

--extensions, -e

running dependency-check ./package.json -e js,jsx:precinct will resolve require paths to .js and .jsx paths, and parse using precinct.

--detective

running dependency-check ./package.json --detective precinct will require() the local precinct as the default parser. This can be set per-extension using using -e. Defaults to parsing with detective.

--verbose

Running with --verbose will enable a log message on success, otherwise dependency-check only logs on failure.

--help

shows above options and all other available options

auto check before every npm publish

add this to your .bash_profile/.bashrc

# originally from https://gist.github.com/mafintosh/405048d304fbabb830b2
npm () {
  ([ "$1" != "publish" ] || dependency-check .) && command npm "[email protected]"
}

now when you do npm publish and you have missing dependencies it won't publish, e.g.:

$ npm publish
Fail! Dependencies not listed in package.json: siblings
$ npm install --save siblings
$ npm publish # works this time

grunt usage

See grunt-dependency-check.

protips

  • detective is used for parsing require() statements, which means it only does static requires. this means you should convert things like var foo = "bar"; require(foo) to be static, e.g. require("bar")
  • use globbing to effectively add all the files you want to check
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].