Skip to content

Commit

Permalink
fix: TypeDoc should warn users about missing entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Nov 27, 2020
1 parent 15cb73c commit 8c51af8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
8 changes: 4 additions & 4 deletions bin/typedoc
Expand Up @@ -27,10 +27,6 @@ process.exit(run(app));

/** @param {td.Application} app */
function run(app) {
if (app.logger.hasErrors()) {
return ExitCodes.OptionError;
}

if (app.options.getValue("version")) {
console.log(app.toString());
return ExitCodes.Ok;
Expand All @@ -40,6 +36,10 @@ function run(app) {
console.log(getOptionsHelp(app.options));
}

if (app.logger.hasErrors()) {
return ExitCodes.OptionError;
}

if (app.options.getValue("entryPoints").length === 0) {
app.logger.error("No entry points provided");
return ExitCodes.NoEntryPoints;
Expand Down
18 changes: 14 additions & 4 deletions src/lib/application.ts
Expand Up @@ -273,9 +273,11 @@ export class Application extends ChildableComponent<
return exclude.some((mm) => mm.match(fileName));
}

const supportedFileRegex = this.options.getCompilerOptions().allowJs
? /\.[tj]sx?$/
: /\.tsx?$/;
const supportedFileRegex =
this.options.getCompilerOptions().allowJs ||
this.options.getCompilerOptions().checkJs
? /\.[tj]sx?$/
: /\.tsx?$/;
function add(file: string, entryPoint: boolean) {
let stats: FS.Stats;
try {
Expand Down Expand Up @@ -303,7 +305,15 @@ export class Application extends ChildableComponent<
}

inputFiles.forEach((file) => {
add(Path.resolve(file), true);
const resolved = Path.resolve(file);
if (!FS.existsSync(resolved)) {
this.logger.warn(
`Provided entry point ${file} does not exist and will not be included in the docs.`
);
return;
}

add(resolved, true);
});

return files;
Expand Down

0 comments on commit 8c51af8

Please sign in to comment.