#!/usr/bin/env node

'use strict';

const dependencyTree = require('../');
const program = require('commander');

program
  .version(require('../package.json').version)
  .usage('[options] <filename>')
  .option('-d, --directory <path>', 'location of files of supported filetypes')
  .option('-c, --require-config <path>', 'path to a requirejs config')
  .option('-w, --webpack-config <path>', 'path to a webpack config')
  .option('--list-form', 'output the list form of the tree (one element per line)')
  .parse(process.argv);

let tree;

const options = {
  filename: program.args[0],
  root: program.directory,
  config: program.requireConfig,
  webpackConfig: program.webpackConfig
};

if (program.listForm) {
  tree = dependencyTree.toList(options);

  tree.forEach(function(node) {
    console.log(node);
  });

} else {
  tree = dependencyTree(options);

  console.log(JSON.stringify(tree));
}

@@ -407,32 +407,99 @@
 ebpack config')%0A
+  .option('-t, --ts-config %3Cpath%3E', 'path to a typescript config')%0A
   .option('--lis
@@ -747,16 +747,46 @@
 ckConfig
+,%0A  tsConfig: program.tsConfig
 %0A%7D;%0A%0Aif 

Add --tsconfig CLI option to specify a TypeScript config file