mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-07 12:47:49 +00:00
fix: do not add a config folder to api path (#1187)
This commit is contained in:
@@ -5,7 +5,7 @@ import { Config, isAbsoluteUrl } from '@redocly/openapi-core';
|
||||
import { renderToString } from 'react-dom/server';
|
||||
import { ServerStyleSheet } from 'styled-components';
|
||||
import { compile } from 'handlebars';
|
||||
import { join } from 'path';
|
||||
import { dirname, join, resolve } from 'path';
|
||||
import { existsSync, lstatSync, readFileSync } from 'fs';
|
||||
|
||||
import type { BuildDocsOptions } from './types';
|
||||
@@ -57,9 +57,10 @@ export async function getPageHTML(
|
||||
templateOptions,
|
||||
redocOptions = {},
|
||||
redocCurrentVersion,
|
||||
}: BuildDocsOptions
|
||||
}: BuildDocsOptions,
|
||||
configPath?: string
|
||||
) {
|
||||
process.stderr.write('Prerendering docs');
|
||||
process.stderr.write('Prerendering docs\n');
|
||||
|
||||
const apiUrl = redocOptions.specUrl || (isAbsoluteUrl(pathToApi) ? pathToApi : undefined);
|
||||
const store = await createStore(api, apiUrl, redocOptions);
|
||||
@@ -72,7 +73,7 @@ export async function getPageHTML(
|
||||
templateFileName = templateFileName
|
||||
? templateFileName
|
||||
: redocOptions?.htmlTemplate
|
||||
? (redocOptions.htmlTemplate as string)
|
||||
? resolve(configPath ? dirname(configPath) : '', redocOptions.htmlTemplate)
|
||||
: join(__dirname, './template.hbs');
|
||||
const template = compile(readFileSync(templateFileName).toString());
|
||||
return template({
|
||||
|
||||
Reference in New Issue
Block a user