How to use dependency-tree - 7 common examples

To help you get started, we’ve selected a few dependency-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mr-doc / mr-doc / src / utils / output.js View on Github external
let files = buffer.map(file => _.merge(file, {
            dependency_list: deptree.toList(dep_opts(file))
        }));
        // Parse the code
github danger / peril / api / source / scripts / generate-runner-deps.ts View on Github external
// @ts-ignore
import * as lockFileGen from "@yarnpkg/lockfile"
// @ts-ignore
import * as dependencyTree from "dependency-tree"
// @ts-ignore
import * as detective from "detective-typescript"
// @ts-ignore

import * as semverSort from "semver-sort"

import * as fs from "fs"
import * as path from "path"

// Starting at the runner, generate a list of all the
// files inside the Peril repo which are referenced by the runner
const tree = dependencyTree.toList({
  filename: path.resolve(__dirname, "..", "runner", "run.ts"),
  directory: path.resolve(__dirname, "..", ".."),
})

const filterDefTypes = (fpath: string) => !fpath.endsWith("d.ts")
const onlyModules = (fpath: string) => !fpath.startsWith(".")

// Filter that list down to just source-files
const perilModules = tree.filter(filterDefTypes)

// Now we pull out every node module reference in
// all of the in-app dependencies
let allDeps: string[] = []

// Hide some of the extra stuff
const builtIn = ["fs", "path", "util", "child_process", "http"]
github Shopify / polaris-react / scripts / playground-upload.js View on Github external
function getDependencyListForComponent(name) {
  const nodeModules = [];
  const dependencies = dependencyTree.toList({
    filename: join(srcPath, 'components', name, 'index.ts'),
    directory: join(srcPath, 'components', name),
    tsConfig: tsConfigPath,
    filter(path) {
      if (path.includes('node_modules')) {
        nodeModules.push(extractPackageNameFromPath(path));
        return false;
      }
      return true;
    },
  });
  return {dependencies, nodeModules};
}
github titon / toolkit / tasks / build-js.js View on Github external
paths.forEach(function(module) {
            let absPath = path.join(options.jsSource, module);

            if (fs.existsSync(absPath)) {
                depTree.toList({
                    filename: absPath,
                    root: options.jsSource,
                    config: './help/tasks/config/paths.json'
                }).forEach(function(item) {
                    tree[item] = true;
                });

                log(module, 1);
            }
        });
github titon / toolkit / tasks / build-js2.js View on Github external
paths.forEach(function(module) {
            depTree.toList(path.join(options.js, module), options.js).forEach(function(item) {
                tree[item] = true;
            });

            log(module, 1);
        });
github siddharthkp / bae / packages / bae / dev / server.js View on Github external
file =>
      (tree[file] = dependencyTree.toList({
        filename: resolve(`./pages/${file}`),
        directory: '/'
      }))
  )
github youzan / vant / packages / vant-cli / src / compiler / gen-style-entry.ts View on Github external
function analyzeDeps(component: string) {
  const checkList = ['base'];

  search(
    dependencyTree({
      directory: ES_DIR,
      filename: join(ES_DIR, component, 'index.js'),
      filter: path => !~path.indexOf('node_modules')
    }),
    component,
    checkList
  );

  checkList.push(component);

  return checkList.filter(checkStyleExists);
}

dependency-tree

Get the dependency tree of a module

MIT
Latest version published 7 months ago

Package Health Score

75 / 100
Full package analysis

Popular dependency-tree functions