12
12
}
13
13
14
14
import * as fs from "fs" ;
15
+ import * as path from "path" ;
15
16
import * as commandpost from "commandpost" ;
16
17
17
18
import * as lib from "./" ;
@@ -29,6 +30,9 @@ interface RootOptions {
29
30
editorconfig : boolean ;
30
31
vscode : boolean ;
31
32
tsfmt : boolean ;
33
+ useTsconfig : string [ ] ;
34
+ useTslint : string [ ] ;
35
+ useTsfmt : string [ ] ;
32
36
verbose : boolean ;
33
37
}
34
38
@@ -48,6 +52,9 @@ let root = commandpost
48
52
. option ( "--no-editorconfig" , "don't read a .editorconfig" )
49
53
. option ( "--no-vscode" , "don't read a .vscode/settings.json" )
50
54
. option ( "--no-tsfmt" , "don't read a tsfmt.json" )
55
+ . option ( "--useTsconfig <path>" , "using specified config file insteaf of tsconfig.json" )
56
+ . option ( "--useTslint <path>" , "using specified config file insteaf of tslint.json" )
57
+ . option ( "--useTsfmt <path>" , "using specified config file insteaf of tsfmt.json" )
51
58
. option ( "--verbose" , "makes output more verbose" )
52
59
. action ( ( opts , args ) => {
53
60
let replace = ! ! opts . replace ;
@@ -59,6 +66,9 @@ let root = commandpost
59
66
let editorconfig = ! ! opts . editorconfig ;
60
67
let vscode = ! ! opts . vscode ;
61
68
let tsfmt = ! ! opts . tsfmt ;
69
+ let tsconfigFile = opts . useTsconfig [ 0 ] ? path . join ( process . cwd ( ) , opts . useTsconfig [ 0 ] ) : null ;
70
+ let tslintFile = opts . useTslint [ 0 ] ? path . join ( process . cwd ( ) , opts . useTslint [ 0 ] ) : null ;
71
+ let tsfmtFile = opts . useTsfmt [ 0 ] ? path . join ( process . cwd ( ) , opts . useTsfmt [ 0 ] ) : null ;
62
72
let verbose = ! ! opts . verbose ;
63
73
64
74
let files = args . files ;
@@ -86,10 +96,19 @@ let root = commandpost
86
96
console . log ( "stdin: " + ( stdin ? "ON" : "OFF" ) ) ;
87
97
console . log ( "files from tsconfig: " + ( useTsconfig ? "ON" : "OFF" ) ) ;
88
98
console . log ( "tsconfig: " + ( tsconfig ? "ON" : "OFF" ) ) ;
99
+ if ( tsconfigFile ) {
100
+ console . log ( "specified tsconfig.json: " + tsconfigFile ) ;
101
+ }
89
102
console . log ( "tslint: " + ( tslint ? "ON" : "OFF" ) ) ;
103
+ if ( tslintFile ) {
104
+ console . log ( "specified tslint.json: " + tslintFile ) ;
105
+ }
90
106
console . log ( "editorconfig: " + ( editorconfig ? "ON" : "OFF" ) ) ;
91
107
console . log ( "vscode: " + ( vscode ? "ON" : "OFF" ) ) ;
92
108
console . log ( "tsfmt: " + ( tsfmt ? "ON" : "OFF" ) ) ;
109
+ if ( tsfmtFile ) {
110
+ console . log ( "specified tsfmt.json: " + tsfmtFile ) ;
111
+ }
93
112
}
94
113
95
114
if ( stdin ) {
@@ -103,10 +122,13 @@ let root = commandpost
103
122
verify : verify ,
104
123
baseDir : baseDir ,
105
124
tsconfig : tsconfig ,
125
+ tsconfigFile : tsconfigFile ,
106
126
tslint : tslint ,
127
+ tslintFile : tslintFile ,
107
128
editorconfig : editorconfig ,
108
129
vscode : vscode ,
109
130
tsfmt : tsfmt ,
131
+ tsfmtFile : tsfmtFile ,
110
132
verbose : verbose ,
111
133
} )
112
134
. then ( result => {
@@ -123,10 +145,13 @@ let root = commandpost
123
145
verify : verify ,
124
146
baseDir : baseDir ,
125
147
tsconfig : tsconfig ,
148
+ tsconfigFile : tsconfigFile ,
126
149
tslint : tslint ,
150
+ tslintFile : tslintFile ,
127
151
editorconfig : editorconfig ,
128
152
vscode : vscode ,
129
153
tsfmt : tsfmt ,
154
+ tsfmtFile : tsfmtFile ,
130
155
verbose : verbose ,
131
156
} )
132
157
. then ( showResultHandler )
0 commit comments