dependency_check_node

This script checks for dependency updates of the Node.js project in the given directory ($PWD if not given).

The optional second parameter determines whether NPM should ignore pre- or post-scripts (default: true) while resolving the project’s dependencies.

Copy the script into your Node.js project and add it as a custom script to your package.json file:

package.json
{
...
  "scripts": {
    "dependency:updates": "scripts/dependency_check_node.sh"
  }
}
$ npm run dependency:updates

For security reasons you might want to disable the pre- or post-scripts globally via:

$ npm config set ignore-scripts true

Use --no-ignore-scripts to enable the pre- or post-scripts for a specific NPM command:

$ npm install --no-ignore-scripts

You can show your current configuration via:

$ npm config ls -l

Usage

$ scripts/dependency_check_node.sh
$ scripts/dependency_check_node.sh /tmp/example
$ scripts/dependency_check_node.sh /tmp/example false

Package             Current  Wanted  Latest  Location                         Depended by  Package Type     Homepage
esbuild              0.23.0  0.23.0  0.23.1  node_modules/esbuild             example      devDependencies  https://github.com/evanw/esbuild#readme
husky                 9.1.4   9.1.4   9.1.5  node_modules/husky               example      devDependencies  https://github.com/typicode/husky#readme