npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

npm-auditor-ci

v0.1.4

Published

A wrapper for 'npm audit' which can be used in CI.

Downloads

513

Readme

Screenshot

npm-auditor-ci

Build Status Maintainability

NPM Auditor CI is meant to be used inside your JS project or globally on your CI environment. It returns the correct exit code and wraps npm audit to provide additional features.

Movie

Installation

Global Installation

$ npm install npm-auditor-ci -g

Project Installation

$ npm install npm-auditor-ci --save-dev

Usage

Global

If you are using it as a global installation make sure you have installed the package and have used npm install to generate the package-lock.json that npm audit needs.

$ cd ~/<my_project>/
$ npm-auditor-ci

Project

Inside your package.json you can add a custom script

"scripts": {
  "audit": "npm-auditor-ci --threshold low --registry https://registry.mydomain.com/"
},

Then inside of your project folder you can run

$ npm run audit

or you can add the npm command to an existing script like

"scripts": {
  "audit": "npm-auditor-ci --threshold low --registry https://registry.mydomain.com/",
  "tests": "mocha tests/",
  "ci":"npm run tests && npm run audit"
},

Options

You can view the help section by running npm-auditor-ci --help

| Options | Argument |Default | Description | |:------------|:------------------------------|:----------------------------|:-----------------------------------------------| | help | | | Displays the help information below. | | threshold | low, moderate, high, critical | low | Sets what level of severity to use. | | ignoreDev | true or false | false | Decide to include development dependencies. | | json | true or false | false | Outputs the results from the audit in JSON. | | registry | https://registry.npmjs.org | https://registry.npmjs.org | Use a custom registry or the default npmjs.org | | version | | | Displays the current versions |

If you specify a threshold of critical it's essentially running all advisories. It takes the level and alerts on all levels below that one.

For example if I use moderate

$ npm-auditor-ci --threshold moderate

I will get all advisories that are moderate AND also high and critical. If you do high, you will get all advisories that are high and critical.


wrapper for 'npm audit' which can be used in CI.

Usage
 $ npm-auditor-ci

Options
 --help,      -h  Displays help information
 --threshold, -t  The threshold in which the auditor fails ('low', 'moderate', 'high', 'critical')
 --ignoreDev  -i  Ignores dev dependencies (default false)
 --json       -j  Displays results in json format (default false)
 --registry   -r  Specifies which registry to use. Default (https://registry.npmjs.org/)
 --version    -v  Gives the version number

Examples
 $ npm-auditor-ci --json --registry=https://npm.mycompany.com/
 Runs json with a different npm registry url

 $ npm-auditor-ci --ignoreDev --threshold=high
 Runs ignoring the dev dependencies and only fails on high level advisories

Help
 Have a problem? Want to help support?
 https://www.github.com/willywos/npm-auditor-ci
 Cheers! 🍻

Contributing

Open an issue, or make a pull request. We love contributions.

If you would like to contribute, please make sure you follow the contribution guidelines inside contributing.md.

Development

$ git clone https://github.com/willywos/npm-auditor-ci.git
$ cd npm-auditor-ci
$ npm install
$ npm run dev

➜ npm run dev

> [email protected] dev /Users/willywos/Projects/npm-auditor-ci
> babel -w src/ --out-dir dist --copy-files --ignore __tests__

Successfully compiled 3 files with Babel.

To run the unit tests

$ npm run test

or

$ npm run test:watch

Run the ci command locally before pushing.

$ npm run ci

To run the app locally to test:

$ node dist/index.js --help

Code of Conduct

Code is important but people are more important. If you like to contribute to npm-auditor-ci please read and follow our code of conduct found in this file: CODE_OF_CONDUCT.md