add: dependency-tree

This commit is contained in:
Joscha Feth 2018-05-15 16:19:30 +10:00
parent d11cc3b1a2
commit 1b754d2d76
4 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import dependencyTree = require('dependency-tree');
const tree = dependencyTree({
filename: 'path/to/a/file',
directory: 'path/to/all/files',
requireConfig: 'path/to/requirejs/config',
webpackConfig: 'path/to/webpack/config',
nodeModulesConfig: {
entry: 'module'
},
filter: path => path.indexOf('node_modules') === -1,
nonExistent: []
});
const list = dependencyTree.toList({
filename: 'path/to/a/file',
directory: 'path/to/all/files'
});

29
types/dependency-tree/index.d.ts vendored Normal file
View File

@ -0,0 +1,29 @@
// Type definitions for dependency-tree 6.1
// Project: https://github.com/mrjoelkemp/node-dependency-tree
// Definitions by: Joscha Feth <https://github.com/joscha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace dependencyTree {
interface DependencyObj {
[k: string]: DependencyObj;
}
interface Options {
filename: string;
directory?: string;
requireConfig?: string;
webpackConfig?: string;
nodeModulesConfig?: any;
detective?: any;
visited?: DependencyObj;
filter?(path: string): boolean;
nonExistent?: string[];
isListForm?: boolean;
}
function toList(options: Options): string[];
}
declare function dependencyTree(options: dependencyTree.Options): dependencyTree.DependencyObj;
export = dependencyTree;

View File

@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dependency-tree-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }