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 {
4848 if ( TSConfigReader . OPTIONS_KEY in event . data ) {
4949 const tsconfig = event . data [ TSConfigReader . OPTIONS_KEY ] ;
5050
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 ( ) ) {
5252 file = Path . resolve ( tsconfig ) ;
5353 } else {
5454 file = ts . findConfigFile ( tsconfig , ts . sys . fileExists ) ;
@@ -59,8 +59,14 @@ export class TSConfigReader extends OptionsComponent {
5959 return ;
6060 }
6161 } 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+ }
6470 } else if ( this . application . isCLI ) {
6571 // No file or directory has been specified so find the file in the root of the project
6672 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 {
5050 return ;
5151 }
5252 } else if ( this . application . isCLI ) {
53- file = this . findTypedocFile ( ) ;
53+ file = this . findTypedocFile ( process . cwd ( ) ) ;
5454 }
5555
5656 file && this . load ( event , file ) ;
@@ -63,8 +63,8 @@ export class TypedocReader extends OptionsComponent {
6363 * typedoc file will be attempted to be found at the root of this path
6464 * @return the typedoc.(js|json) file path or undefined
6565 */
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 ( ) ) {
6868 return path ;
6969 }
7070
You can’t perform that action at this time.
0 commit comments