fix: handle htmlTemplate option for build-docs command (#1071)

This commit is contained in:
Alex Varchuk
2023-05-09 16:51:29 +03:00
committed by GitHub
parent 6f407e8647
commit a924d0c0d2

View File

@@ -37,7 +37,7 @@ export function getObjectOrJSON(
break;
default: {
if (config) {
process.stderr.write(`Found ${config.configFile} and using theme.openapi options`);
process.stderr.write(`Found ${config.configFile} and using theme.openapi options\n`);
return config.theme.openapi ? config.theme.openapi : {};
}
@@ -70,7 +70,11 @@ export async function getPageHTML(
const state = await store.toJS();
const css = sheet.getStyleTags();
templateFileName = templateFileName ? templateFileName : join(__dirname, './template.hbs');
templateFileName = templateFileName
? templateFileName
: redocOptions?.htmlTemplate
? (redocOptions.htmlTemplate as string)
: join(__dirname, './template.hbs');
const template = compile(readFileSync(templateFileName).toString());
return template({
redocHTML: `