diff --git a/src/lib/application.ts b/src/lib/application.ts index 27dbac364..594df602a 100644 --- a/src/lib/application.ts +++ b/src/lib/application.ts @@ -126,7 +126,7 @@ export class Application extends ChildableComponent< /** * The version number of TypeDoc. */ - static VERSION = packageInfo.version; + static readonly VERSION = packageInfo.version; /** * Emitted after plugins have been loaded and options have been read, but before they have been frozen. @@ -525,6 +525,7 @@ export class Application extends ChildableComponent< const start = Date.now(); out = Path.resolve(out); await this.renderer.render(project, out); + if (this.logger.hasErrors()) { this.logger.error( "Documentation could not be generated due to the errors above.", @@ -551,6 +552,7 @@ export class Application extends ChildableComponent< const space = this.options.getValue("pretty") ? "\t" : ""; await writeFile(out, JSON.stringify(ser, null, space)); + this.logger.info(`JSON written to ${nicePath(out)}`); this.logger.verbose(`JSON rendering took ${Date.now() - start}ms`); } diff --git a/src/lib/cli.ts b/src/lib/cli.ts index 7bdf947e8..c1472a5ea 100644 --- a/src/lib/cli.ts +++ b/src/lib/cli.ts @@ -31,6 +31,7 @@ async function main() { const exitCode = await run(app); if (exitCode !== ExitCodes.Watching) { app.logger.verbose(`Full run took ${Date.now() - start}ms`); + logRunSummary(app.logger); process.exit(exitCode); } } catch (error) { @@ -135,3 +136,17 @@ async function run(app: td.Application) { return ExitCodes.Ok; } + +/** + * Generate a string with the number of errors and warnings found. + */ +function logRunSummary(logger: td.Logger): void { + const { errorCount, warningCount } = logger; + if (errorCount) { + logger.error( + `Found: ${errorCount} error(s), ${warningCount} warnings.`, + ); + } else if (warningCount) { + logger.warn(`Found: ${errorCount} error(s), ${warningCount} warnings.`); + } +}