Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a flag to not build index.html #4258

Merged
merged 1 commit into from
Jul 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions build/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ async function buildDocuments(
files = null,
quiet = false,
interactive = false,
noHTML = false,
locales = new Map()
) {
// If a list of files was set, it came from the CLI.
Expand Down Expand Up @@ -139,10 +140,13 @@ async function buildDocuments(
appendTotalFlaws(builtDocument.flaws);
}

fs.writeFileSync(
path.join(outPath, "index.html"),
renderHTML(document.url, { doc: builtDocument })
);
if (!noHTML) {
fs.writeFileSync(
path.join(outPath, "index.html"),
renderHTML(document.url, { doc: builtDocument })
);
}

fs.writeFileSync(
path.join(outPath, "index.json"),
// This is exploiting the fact that renderHTML has the side-effect of
Expand Down Expand Up @@ -282,6 +286,9 @@ program
.option("-i, --interactive", "Ask what to do when encountering flaws", {
default: false,
})
.option("-n, --nohtml", "Do not build index.html", {
peterbe marked this conversation as resolved.
Show resolved Hide resolved
default: false,
})
.option("-l, --locale <locale...>", "Filtered specific locales", {
default: [],
validator: [...VALID_LOCALES.keys()],
Expand Down Expand Up @@ -321,6 +328,7 @@ program
files,
Boolean(options.quiet),
Boolean(options.interactive),
Boolean(options.nohtml),
locales
);
const t1 = new Date();
Expand Down