lint-deps
CLI tool that tells you when dependencies are missing from package.json and offers you a choice to install them. Also tells you when dependencies are listed in package.json but are not being used anywhere in your project. Node.js command line tool and API
Last updated 4 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install lint-deps -g
SYNC missed versions from official npm registry.

lint-deps NPM version

CLI tool that tells you when dependencies are missing from package.json and offers you a choice to install them. Also tells you when dependencies are listed in package.json but are not being used anywhere in your project. Node.js command line tool and API.

Install

Install globally with npm

$ npm i -g lint-deps

CLI

In the command line, run:

deps

Commands

  • -r | --report: save a report to disk. By default report.json is saved. To change the path do: -r foo.json
  • -e | --exclude: comma-separated list of files or directories to exclude. Example: deps -e test,lib

Examples

If everything is good, you'll see something like this:

image

Install missing packages

If packages are missing, you'll see a prompt like this (also shows which files require the package):

image

If you choose <kbd>yes</kbd>:

image

choose dependencies

Works the same way for devDependencies:

image

choose "nothing, just install"

image

Now hit <kbd>enter</kbd> and everything that was checked will be installed.

If you choose <kbd>no</kbd>:

image

Done.

API

var deps = require('lint-deps');

// pass the directory to scan
console.log(deps('lib'));

Manually define dependencies

When dependencies are defined in a format that isn't recognized by lint-deps, like with grunt tasks (e.g. grunt.loadNpmTasks()), you can manually specify these dependencies in code comments, similar to jshint commands.

Example:

Make sure deps is the first thing, and pass a space separated list of module names:

/** deps: foo bar baz */

If you use verb, you can use HTML code comments in your .verb.md file:

{%= reflinks() %}
<!-- deps: helper-reflinks -->

Related projects

  • list-deps: List the dependencies in the package.json of the current project. | homepage
  • lookup-deps: Simple API for getting metadata from locally installed npm packages (in node_modules). | homepage
  • resolve-dep: Return an array of resolved filepaths for require-able local or named npm modules. Wildcard (glob)… more | homepage
  • spawn-commands: Launches a new process with the given command, with command line arguments in args. Should… more | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on November 17, 2015.

Current Tags

  • 3.0.2                                ...           latest (4 years ago)

43 Versions

  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.6.0                                ...           5 years ago
  • 2.5.2                                ...           5 years ago
  • 2.5.1                                ...           5 years ago
  • 2.5.0                                ...           5 years ago
  • 2.4.0                                ...           5 years ago
  • 2.2.4                                ...           5 years ago
  • 2.2.3                                ...           5 years ago
  • 2.2.2                                ...           5 years ago
  • 2.2.1                                ...           5 years ago
  • 2.2.0                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.4                                ...           5 years ago
  • 1.1.3                                ...           5 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.6.2                                ...           5 years ago
  • 0.6.1                                ...           5 years ago
  • 0.6.0                                ...           5 years ago
  • 0.5.2                                ...           5 years ago
  • 0.5.1                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.1                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.8                                ...           6 years ago
  • 0.2.6                                ...           6 years ago
  • 0.2.5                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.7                                ...           6 years ago
  • 0.1.6                                ...           6 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 43
Dependencies (24)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |