@@ -12,7 +12,7 @@ import {
1212import { createMinimatch , matchesAny , nicePath , normalizePath } from "./paths" ;
1313import type { Logger } from "./loggers" ;
1414import type { Options } from "./options" ;
15- import { deriveRootDir , glob } from "./fs" ;
15+ import { deriveRootDir , glob , isDir } from "./fs" ;
1616import { assertNever } from "./general" ;
1717
1818/**
@@ -64,21 +64,26 @@ export function getEntryPoints(
6464) : DocumentationEntryPoint [ ] | undefined {
6565 const entryPoints = options . getValue ( "entryPoints" ) ;
6666
67+ if ( entryPoints . length === 0 ) {
68+ logger . error ( "No entry points were provided." ) ;
69+ return ;
70+ }
71+
6772 let result : DocumentationEntryPoint [ ] | undefined ;
6873 const strategy = options . getValue ( "entryPointStrategy" ) ;
6974 switch ( strategy ) {
7075 case EntryPointStrategy . Resolve :
7176 result = getEntryPointsForPaths (
7277 logger ,
73- expandGlobs ( entryPoints ) ,
78+ expandGlobs ( entryPoints , logger ) ,
7479 options
7580 ) ;
7681 break ;
7782
7883 case EntryPointStrategy . Expand :
7984 result = getExpandedEntryPointsForPaths (
8085 logger ,
81- expandGlobs ( entryPoints ) ,
86+ expandGlobs ( entryPoints , logger ) ,
8287 options
8388 ) ;
8489 break ;
@@ -101,9 +106,7 @@ export function getEntryPoints(
101106 }
102107
103108 if ( result && result . length === 0 ) {
104- logger . error (
105- "Unable to find any entry points. Make sure TypeDoc can find your tsconfig"
106- ) ;
109+ logger . error ( "Unable to find any entry points. See previous warnings." ) ;
107110 return ;
108111 }
109112
@@ -210,10 +213,14 @@ function getEntryPointsForPaths(
210213 }
211214 }
212215 }
216+
217+ const suggestion = isDir ( fileOrDir )
218+ ? " If you wanted to include files inside this directory, set --entryPointStrategy to expand or specify a glob."
219+ : "" ;
213220 logger . warn (
214221 `The entry point ${ nicePath (
215222 fileOrDir
216- ) } does not exist or is not included in the program for your provided tsconfig.`
223+ ) } is not included in the program for your provided tsconfig.${ suggestion } `
217224 ) ;
218225 }
219226
@@ -234,11 +241,30 @@ export function getExpandedEntryPointsForPaths(
234241 ) ;
235242}
236243
237- function expandGlobs ( inputFiles : string [ ] ) {
244+ function expandGlobs ( inputFiles : string [ ] , logger : Logger ) {
238245 const base = deriveRootDir ( inputFiles ) ;
239- const result = inputFiles . flatMap ( ( entry ) =>
240- glob ( entry , base , { includeDirectories : true , followSymlinks : true } )
241- ) ;
246+ const result = inputFiles . flatMap ( ( entry ) => {
247+ const result = glob ( entry , base , {
248+ includeDirectories : true ,
249+ followSymlinks : true ,
250+ } ) ;
251+
252+ if ( result . length === 0 ) {
253+ logger . warn (
254+ `The entrypoint glob ${ nicePath (
255+ entry
256+ ) } did not match any files.`
257+ ) ;
258+ } else {
259+ logger . verbose (
260+ `Expanded ${ nicePath ( entry ) } to:\n\t${ result
261+ . map ( nicePath )
262+ . join ( "\n\t" ) } `
263+ ) ;
264+ }
265+
266+ return result ;
267+ } ) ;
242268 return result ;
243269}
244270
0 commit comments