From da27756d9c08b2353e375523a9cf93a5496c9fc7 Mon Sep 17 00:00:00 2001 From: Gerrit Birkeland Date: Thu, 24 Jun 2021 20:18:10 -0600 Subject: [PATCH] fix: `readme` could not be set to `none` in a config file Closes #1608 --- src/lib/converter/plugins/PackagePlugin.ts | 3 +-- src/lib/output/themes/DefaultTheme.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/converter/plugins/PackagePlugin.ts b/src/lib/converter/plugins/PackagePlugin.ts index 96901b44a..af2fe4954 100644 --- a/src/lib/converter/plugins/PackagePlugin.ts +++ b/src/lib/converter/plugins/PackagePlugin.ts @@ -6,7 +6,6 @@ import { Converter } from "../converter"; import { Context } from "../context"; import { BindOption, readFile } from "../../utils"; import { getCommonDirectory } from "../../utils/fs"; -import { join } from "path"; /** * A handler that tries to find the package.json and readme.md files of the @@ -48,7 +47,7 @@ export class PackagePlugin extends ConverterComponent { this.packageFile = undefined; // Path will be resolved already. This is kind of ugly, but... - const noReadmeFile = this.readme == join(process.cwd(), "none"); + const noReadmeFile = this.readme.endsWith("none"); if (!noReadmeFile && this.readme) { if (FS.existsSync(this.readme)) { this.readmeFile = this.readme; diff --git a/src/lib/output/themes/DefaultTheme.ts b/src/lib/output/themes/DefaultTheme.ts index 0a6762d91..09c5a030b 100644 --- a/src/lib/output/themes/DefaultTheme.ts +++ b/src/lib/output/themes/DefaultTheme.ts @@ -130,7 +130,7 @@ export class DefaultTheme extends Theme { getUrls(project: ProjectReflection): UrlMapping[] { const urls: UrlMapping[] = []; - if (this.application.options.getValue("readme") === "none") { + if (false == hasReadme(this.application.options.getValue("readme"))) { project.url = "index.html"; urls.push(new UrlMapping("index.html", project, "reflection.hbs")); } else { @@ -165,7 +165,7 @@ export class DefaultTheme extends Theme { multipleEntryPoints ); return builder.build( - this.application.options.getValue("readme") !== "none" + hasReadme(this.application.options.getValue("readme")) ); } @@ -581,3 +581,7 @@ export class NavigationBuilder { })(reflection); } } + +function hasReadme(readme: string) { + return !readme.endsWith("none"); +}