nodeshift / npcheck

"Node Package Checker" - A tool to run various checks on npm modules
16 stars 6 forks source link

NPCheck

"Node Package Checker" - A tool to run various checks on npm modules

Node.js CI Coverage Status

Prerequisites

Install

To install globally: npm i -g npcheck

Configuration

Npcheck requires a configuration file where custom behavior can be specified. The configuration file have to be named npcheck.json in order for npcheck to pick it up.

Options

Example

A simple npcheck configuration file.

{
  "modules": [
    {
      "name": "express",
      "npmLink": "https://www.npmjs.com/package/express"
    }
  ],
  "licenses": {
    "allow": ["MIT", "Apache-2.0"],
    "rules": {}
  },
  "citgm": {
    "skip": ["rhea"]
  },
  "audit": {
    "allow": {
      "CVE-2022-0235": [{
        "name": "node-fetch",
        "effects": ["opencollective"]
      }]
    }
  }
}

Advanced Options

While npcheck is very opinionated about how it works there is also some extra options you can use to change it's behavior.

version

Outputs the current version of npcheck.

github-token

GitHub's OAuth token npcheck will use when contacting the GitHub API.

no-errors

Treats all errors as warnings.

help

Shows the below help.

Usage: npcheck [options]

Options:
  --help                Show help                                      [boolean]
  --version             Show version number                            [boolean]
  --github-token        Custom GitHub token provided to the API for resources
                        (env variable GITHUB_TOKEN is also an option)
                                                            [string] [default: null]
  --no-errors           Treats every error as a warning     [boolean] [default: false]