danger-plugin-node-dependencies

Keep dependencies as low as possible.

Warns or fails on new dependencies in package.json.

Usage

Install

npm install --save-dev danger-plugin-node-dependencies

At a glance

// dangerfile.ts
import { warnDependencies, failDependencies } from 'danger-plugin-node-dependencies'

// Warn of all dependencies added since the last commit
warnDependencies()

// Warn on new dev dependencies, fail on new dependencies
warnDependencies({ devDependencies: true })
failDependencies({ dependencies: true })

Sample output


Added dependencies:
  • dotenv install size
  • helmet install size ##### Added dev dependencies:
  • @types/dotenv install size
  • @types/helmet install size

* eslint install size

API

danger-plugin-node-dependencies exports two functions: * warnDependencies(options) * failDependencies(options)

The functions produce identical messages notifying you of dependencies added to package.json, but the former produces only warning messages, while the latter causes Danger to fail when added dependencies are found.

The options are passed in the form ts { dependencies: boolean, devDependencies: boolean } If a key is omitted, it defaults to false. Passing no options will result in notification of all new dependencies.

Credits

This project was created by Levi Bostian and Oliver Emery.

Dependency size badges in ouput messages are provided by Package Phobia.