@@ -28,34 +28,36 @@ var Application;
2828 Application . run = function ( ) {
2929 program . silent = program . silent || false ;
3030 ngd_core_1 . logger . setVerbose ( program . silent ) ;
31+ var options = program . opts ( ) ;
32+ var output = '' ;
3133 var files = [ ] ;
32- if ( program . file ) {
33- if ( ! fs . existsSync ( program . file ) || ! fs . existsSync ( path . join ( process . cwd ( ) , program . file ) ) ) {
34- ngd_core_1 . logger . fatal ( "\"" + program . file + "\" file was not found" ) ;
34+ if ( options . file ) {
35+ if ( ! fs . existsSync ( options . file ) || ! fs . existsSync ( path . join ( process . cwd ( ) , options . file ) ) ) {
36+ ngd_core_1 . logger . fatal ( "\"" . concat ( options . file , "\" file was not found" ) ) ;
3537 process . exit ( 1 ) ;
3638 }
37- else if ( path . extname ( program . file ) !== '.ts' ) {
38- ngd_core_1 . logger . fatal ( "\"" + program . file + "\" is not a TypeScript file" ) ;
39+ else if ( path . extname ( options . file ) !== '.ts' ) {
40+ ngd_core_1 . logger . fatal ( "\"" . concat ( options . file , "\" is not a TypeScript file" ) ) ;
3941 process . exit ( 1 ) ;
4042 }
4143 else {
42- ngd_core_1 . logger . info ( 'using entry' , program . file ) ;
43- files = [ program . file ] ;
44+ ngd_core_1 . logger . info ( 'using entry' , options . file ) ;
45+ files = [ options . file ] ;
4446 }
4547 }
46- else if ( program . tsconfig ) {
47- if ( ! fs . existsSync ( program . tsconfig ) ) {
48+ else if ( options . tsconfig ) {
49+ if ( ! fs . existsSync ( options . tsconfig ) ) {
4850 ngd_core_1 . logger . fatal ( '"tsconfig.json" file was not found in the current directory' ) ;
4951 process . exit ( 1 ) ;
5052 }
5153 else {
52- program . tsconfig = path . join ( path . join ( process . cwd ( ) , path . dirname ( program . tsconfig ) ) , path . basename ( program . tsconfig ) ) ;
53- ngd_core_1 . logger . info ( 'using tsconfig' , program . tsconfig ) ;
54- files = require ( program . tsconfig ) . files ;
54+ options . tsconfig = path . join ( path . join ( process . cwd ( ) , path . dirname ( options . tsconfig ) ) , path . basename ( options . tsconfig ) ) ;
55+ ngd_core_1 . logger . info ( 'using tsconfig' , options . tsconfig ) ;
56+ files = require ( options . tsconfig ) . files ;
5557 // use the current directory of tsconfig.json as a working directory
56- cwd = program . tsconfig . split ( path . sep ) . slice ( 0 , - 1 ) . join ( path . sep ) ;
58+ cwd = options . tsconfig . split ( path . sep ) . slice ( 0 , - 1 ) . join ( path . sep ) ;
5759 if ( ! files ) {
58- var exclude_1 = require ( program . tsconfig ) . exclude || [ ] ;
60+ var exclude_1 = require ( options . tsconfig ) . exclude || [ ] ;
5961 var walk_1 = function ( dir ) {
6062 var results = [ ] ;
6163 var list = fs . readdirSync ( dir ) ;
@@ -84,11 +86,11 @@ var Application;
8486 else {
8587 outputHelp ( ) ;
8688 }
87- if ( path . isAbsolute ( program . output ) ) {
88- program . output = program . output ;
89+ if ( path . isAbsolute ( options . output ) ) {
90+ output = options . output ;
8991 }
9092 else {
91- program . output = path . resolve ( process . cwd ( ) , program . output ) ;
93+ output = path . resolve ( process . cwd ( ) , options . output ) ;
9294 }
9395 var compiler = new ngd_compiler_1 . Compiler ( files , {
9496 tsconfigDirectory : cwd ,
@@ -101,15 +103,15 @@ var Application;
101103 process . exit ( 0 ) ;
102104 }
103105 var engine = new ngd_transformer_1 . DotEngine ( {
104- output : program . output ,
105- displayLegend : program . displayLegend ,
106- outputFormats : program . outputFormats . split ( ',' ) ,
106+ output : output ,
107+ displayLegend : options . displayLegend ,
108+ outputFormats : options . outputFormats . split ( ',' ) ,
107109 } ) ;
108110 engine
109111 . generateGraph ( deps )
110112 . then ( function ( file ) {
111113 /*
112- if (program .open === true) {
114+ if (options .open === true) {
113115 logger.info('openning file ', file);
114116 let open = require("opener");
115117 open(file);
0 commit comments