resolve-dep
v0.6.0
Published
Return an array of resolved filepaths for require-able local or named npm modules. Wildcard (glob) patterns may be used.
Downloads
11,684
Readme
resolve-dep
Return an array of resolved filepaths for require-able local or named npm modules. Wildcard (glob) patterns may be used.
Install
Install with npm:
$ npm install --save resolve-dep
Usage
Similar in concept to matchdep and load-grunt-tasks, but returns an array of fully resolved file paths to any local modules or npm modules listed in package.json dependencies.
var resolve = require('resolve-dep');
resolve( patterns, options )
patterns
Type: string|array
The file path, glob pattern, or name of the npm module to resolve.
File paths
resolve('templates/*.hbs')
resolve(['a/*.hbs', 'b/*.hbs'])
NPM modules
resolve('*')
resolve(['grunt-*', 'gulp-*'])
resolve(['grunt-*', 'gulp-*'], {type: 'devDependencies'})
resolve(['lodash', 'assemble']);
Options
Type: object
The options object supports any globby options, as well as the following:
options.config
Type: Object
Default value: package.json
Pass an explicit config object to use instead of package.json.
options.type
Type: String|Array
Default value: all
Valid values: all|dependencies|devDepencies|peerDependencies
Any valid npm dependency field that can be used in package.json is a valid value for this option.
Examples:
// resolve chai and mocha, if in devDependencies, otherwise an empty array
resolve(['chai', 'mocha'], {type: 'devDependencies'});
// resolve lodash if in dependencies, otherwise an empty array
resolve(['lodash'], {type: 'dependencies'});
// all dependencies
resolve(['*'], {type: 'dependencies'});
// all dependencies, devDependencies and peerDependencies
resolve('*');
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Contributors
| Commits | Contributor | | --- | --- | | 36 | jonschlinkert | | 4 | tunnckoCore | | 2 | TrySound | | 2 | doowb | | 1 | jaridmargolin |
Building docs
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb-generate-readme, v0.2.0, on December 10, 2016.