@@ -28,34 +28,36 @@ var Application;
28
28
Application . run = function ( ) {
29
29
program . silent = program . silent || false ;
30
30
ngd_core_1 . logger . setVerbose ( program . silent ) ;
31
+ var options = program . opts ( ) ;
32
+ var output = '' ;
31
33
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" ) ) ;
35
37
process . exit ( 1 ) ;
36
38
}
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" ) ) ;
39
41
process . exit ( 1 ) ;
40
42
}
41
43
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 ] ;
44
46
}
45
47
}
46
- else if ( program . tsconfig ) {
47
- if ( ! fs . existsSync ( program . tsconfig ) ) {
48
+ else if ( options . tsconfig ) {
49
+ if ( ! fs . existsSync ( options . tsconfig ) ) {
48
50
ngd_core_1 . logger . fatal ( '"tsconfig.json" file was not found in the current directory' ) ;
49
51
process . exit ( 1 ) ;
50
52
}
51
53
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 ;
55
57
// 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 ) ;
57
59
if ( ! files ) {
58
- var exclude_1 = require ( program . tsconfig ) . exclude || [ ] ;
60
+ var exclude_1 = require ( options . tsconfig ) . exclude || [ ] ;
59
61
var walk_1 = function ( dir ) {
60
62
var results = [ ] ;
61
63
var list = fs . readdirSync ( dir ) ;
@@ -84,11 +86,11 @@ var Application;
84
86
else {
85
87
outputHelp ( ) ;
86
88
}
87
- if ( path . isAbsolute ( program . output ) ) {
88
- program . output = program . output ;
89
+ if ( path . isAbsolute ( options . output ) ) {
90
+ output = options . output ;
89
91
}
90
92
else {
91
- program . output = path . resolve ( process . cwd ( ) , program . output ) ;
93
+ output = path . resolve ( process . cwd ( ) , options . output ) ;
92
94
}
93
95
var compiler = new ngd_compiler_1 . Compiler ( files , {
94
96
tsconfigDirectory : cwd ,
@@ -101,15 +103,15 @@ var Application;
101
103
process . exit ( 0 ) ;
102
104
}
103
105
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 ( ',' ) ,
107
109
} ) ;
108
110
engine
109
111
. generateGraph ( deps )
110
112
. then ( function ( file ) {
111
113
/*
112
- if (program .open === true) {
114
+ if (options .open === true) {
113
115
logger.info('openning file ', file);
114
116
let open = require("opener");
115
117
open(file);
0 commit comments