$ npm install resolve-dep
Return an array of resolved filepaths for require-able local or named npm modules. Wildcard (glob) patterns may be used.
Install with npm:
$ npm install --save resolve-dep
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 )
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']);
Type: object
The options object supports any globby options, as well as the following:
Type: Object
Default value: package.json
Pass an explicit config object to use instead of package.json.
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('*');
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Commits | Contributor |
---|---|
36 | jonschlinkert |
4 | tunnckoCore |
2 | TrySound |
2 | doowb |
1 | jaridmargolin |
(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
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb-generate-readme, v0.2.0, on December 10, 2016.
© 2010 - cnpmjs.org x YWFE | Home | YWFE