Skip to content

Commit

Permalink
fix: readme could not be set to none in a config file
Browse files Browse the repository at this point in the history
Closes #1608
  • Loading branch information
Gerrit0 committed Jun 25, 2021
1 parent bf79e32 commit da27756
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/lib/converter/plugins/PackagePlugin.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/lib/output/themes/DefaultTheme.ts
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"))
);
}

Expand Down Expand Up @@ -581,3 +581,7 @@ export class NavigationBuilder {
})(reflection);
}
}

function hasReadme(readme: string) {
return !readme.endsWith("none");
}

0 comments on commit da27756

Please sign in to comment.