package-dependencies-file-paths
Resolve dependencies file paths in a
package.json
.
Install
$ npm install --save package-dependencies-file-paths
Usage
File Structure
├── node_modules
│ ├─ ...
│ ├─ globby
│ ├─ lodash
│ └─ ...
├── example.js
└── package.json
package.json
//... "dependencies": //... "globby": "~6.1.0" "lodash": "~4.17.2" //... //...
example.js
var packageDependenciesFilePaths = ;var path = ; var cwd = process;var options = includeDotFiles: false ignore: '**/{doc,docs,example,examples,fixture,fixtures,spec,test,tests}/**' '**/{bower,component}.json' '**/{gulpfile,Gruntfile}.js' '**/{LICENCE,LICENSE,License,license}' '**/*.{spec,test}.js' '**/*.{markdown,md,ts}' { return filePath; } sort: true;var pkgJson = ;;
Output from code above should look like this:
//... "node_modules/glob/common.js" "node_modules/glob/glob.js" "node_modules/glob/package.json" //... "node_modules/globby/index.js" "node_modules/globby/package.json" //... "node_modules/lodash/fp/__.js" //... "node_modules/lodash/package.json" //... "node_modules/pinky_promise/index.js" "node_modules/pinky_promise/package.json" //...
API
packageDependenciesFilePaths(packageJson, [options], [callback])
Resolve dependencies file paths in packageJson
.
packageJson
Type: Object
package.json
Object.
[options]
Type: Object
[includeDotFiles]
Type: Boolean
Default: false
[ignore]
Type: String[]
Default: []
See node-glob
glob-primer
[dependenciesSets]
Type: String[]
Possible Values: dependencies
, devDependencies
, peerDependencies
Default: ["dependencies"]
[transformPath]
Type: Function
[sort]
Type: Boolean
Default: false
[callback]
Type: Function
err
Type: Error
filePaths
Type: String[]
License
MIT © Huhgawz