pkg-deps

Pretty-print package.json dependencies in the current project

Usage no npm install needed!

<script type="module">
  import pkgDeps from 'https://cdn.skypack.dev/pkg-deps';
</script>

README

pkg-deps

npm version Build Status Coverage Status

pkg-deps is a command-line utility for pretty-printing your project's current dependencies, as they appear in package.json. That's it. That's all it does.

pkg-deps will look for a package.json in your current working directory, and if there is none to be found, it will recursively traverse up the parent directory tree until it finds a package.json.

Installation

$ npm install -g pkg-deps

Usage

Show all dependencies:

$ pkg-deps

Example output:

dependencies
cli-color            ^1.1.0
minimist             ^1.2.0

devDependencies
babel-cli                  ^6.18.0
babel-eslint               ^7.1.1
coveralls                  ^2.11.12
eslint                     ^3.4.0
eslint-config-uber-es2015  ^3.0.1
eslint-config-uber-es5     ^1.0.1
istanbul                   ^0.4.5
sinon                      ^1.17.5
tap-spec                   ^4.1.1
tape                       ^4.6.0

Show only dev dependencies:

$ pkg-deps --dev

Example output:

devDependencies
babel-cli                  ^6.18.0
babel-eslint               ^7.1.1
coveralls                  ^2.11.12
eslint                     ^3.4.0
eslint-config-uber-es2015  ^3.0.1
eslint-config-uber-es5     ^1.0.1
istanbul                   ^0.4.5
sinon                      ^1.17.5
tap-spec                   ^4.1.1
tape                       ^4.6.0

Why?

While developing I check my current package.json dependencies very frequently, for a variety of reasons:

  1. See what version of a package I have installed
  2. Check if a package I need is already installed
  3. Check if I forgot to remove an unneeded dependency from package.json

cat package.json is fine but it prints a huge JSON blob that I need to visually parse through for a small bit of information. What's more annoying is if I'm working in a subdirectory of my project and I need to cd ../../../ until I reach the root to cat package.json.

pkg-deps attempts to solve both of these problems.