File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
src/lib/utils/options/readers Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export class TSConfigReader extends OptionsComponent {
48
48
if ( TSConfigReader . OPTIONS_KEY in event . data ) {
49
49
const tsconfig = event . data [ TSConfigReader . OPTIONS_KEY ] ;
50
50
51
- if ( / t s c o n f i g \. j s o n $ / . test ( tsconfig ) ) {
51
+ if ( FS . existsSync ( tsconfig ) && FS . statSync ( tsconfig ) . isFile ( ) ) {
52
52
file = Path . resolve ( tsconfig ) ;
53
53
} else {
54
54
file = ts . findConfigFile ( tsconfig , ts . sys . fileExists ) ;
@@ -59,8 +59,14 @@ export class TSConfigReader extends OptionsComponent {
59
59
return ;
60
60
}
61
61
} else if ( TSConfigReader . PROJECT_KEY in event . data ) {
62
- // The `project` option may be a directory or file, so use TS to find it
63
- file = ts . findConfigFile ( event . data [ TSConfigReader . PROJECT_KEY ] , ts . sys . fileExists ) ;
62
+ const resolved = Path . resolve ( event . data [ TSConfigReader . PROJECT_KEY ] ) ;
63
+ // If the file exists, use it
64
+ if ( FS . existsSync ( resolved ) ) {
65
+ file = resolved ;
66
+ } else {
67
+ // Use TS to find the file, since it could be a directory
68
+ file = ts . findConfigFile ( resolved , ts . sys . fileExists ) ;
69
+ }
64
70
} else if ( this . application . isCLI ) {
65
71
// No file or directory has been specified so find the file in the root of the project
66
72
file = ts . findConfigFile ( '.' , ts . sys . fileExists ) ;
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export class TypedocReader extends OptionsComponent {
50
50
return ;
51
51
}
52
52
} else if ( this . application . isCLI ) {
53
- file = this . findTypedocFile ( ) ;
53
+ file = this . findTypedocFile ( process . cwd ( ) ) ;
54
54
}
55
55
56
56
file && this . load ( event , file ) ;
@@ -63,8 +63,8 @@ export class TypedocReader extends OptionsComponent {
63
63
* typedoc file will be attempted to be found at the root of this path
64
64
* @return the typedoc.(js|json) file path or undefined
65
65
*/
66
- findTypedocFile ( path : string = process . cwd ( ) ) : string | undefined {
67
- if ( / t y p e d o c \. j s ( o n ) ? $ / . test ( path ) ) {
66
+ findTypedocFile ( path : string ) : string | undefined {
67
+ if ( FS . existsSync ( path ) && FS . statSync ( path ) . isFile ( ) ) {
68
68
return path ;
69
69
}
70
70
You can’t perform that action at this time.
0 commit comments