File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/lib/utils/options/readers Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,27 @@ export class TSConfigReader extends OptionsComponent {
23
23
*/
24
24
private static OPTIONS_KEY = 'tsconfig' ;
25
25
26
+ /**
27
+ * The name of the parameter that specifies the TS project
28
+ *
29
+ * https://github.com/Microsoft/TypeScript/blob/master/src/compiler/commandLineParser.ts#L49
30
+ */
31
+ private static PROJECT_KEY = 'project' ;
32
+
26
33
initialize ( ) {
27
34
this . listenTo ( this . owner , DiscoverEvent . DISCOVER , this . onDiscover , - 100 ) ;
28
35
}
29
36
30
37
onDiscover ( event : DiscoverEvent ) {
31
38
if ( TSConfigReader . OPTIONS_KEY in event . data ) {
32
39
this . load ( event , Path . resolve ( event . data [ TSConfigReader . OPTIONS_KEY ] ) ) ;
40
+ } else if ( TSConfigReader . PROJECT_KEY in event . data ) {
41
+ // The `project` option may be a directory or file, so use TS to find it
42
+ let file : string = ts . findConfigFile ( event . data [ TSConfigReader . PROJECT_KEY ] , ts . sys . fileExists ) ;
43
+ // If file is undefined, we found no file to load.
44
+ if ( file ) {
45
+ this . load ( event , file ) ;
46
+ }
33
47
} else if ( this . application . isCLI ) {
34
48
let file : string = ts . findConfigFile ( '.' , ts . sys . fileExists ) ;
35
49
// If file is undefined, we found no file to load.
You can’t perform that action at this time.
0 commit comments