Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Jan 22, 2025
1 parent dca0006 commit bab78be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions packages/cli/docs-preview/src/previewDocs.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { readFile } from "fs/promises";
import { v4 as uuidv4 } from "uuid";

import { DocsDefinitionResolver, filterOssWorkspaces } from "@fern-api/docs-resolver";
import {
APIV1Read,
APIV1Write,
convertAPIDefinitionToDb,
convertDbAPIDefinitionToRead,
convertDbDocsConfigToRead,
convertDocsDefinitionToDb,
DocsV1Read,
FdrAPI,
FernNavigation,
SDKSnippetHolder,
convertAPIDefinitionToDb,
convertDbAPIDefinitionToRead,
convertDbDocsConfigToRead,
convertDocsDefinitionToDb
} from "@fern-api/fdr-sdk";
import { AbsoluteFilePath, convertToFernHostAbsoluteFilePath, relative } from "@fern-api/fs-utils";
import { IntermediateRepresentation } from "@fern-api/ir-sdk";
import { Project } from "@fern-api/project-loader";
import { convertIrToFdrApi } from "@fern-api/register";
import { TaskContext } from "@fern-api/task-context";
import { readFile } from "fs/promises";

import { replaceReferencedMarkdown } from "../../docs-markdown-utils/src";

export async function getPreviewDocsDefinition({
Expand All @@ -34,7 +35,6 @@ export async function getPreviewDocsDefinition({
previousDocsDefinition?: DocsV1Read.DocsDefinition;
editedAbsoluteFilepaths?: AbsoluteFilePath[];
}): Promise<DocsV1Read.DocsDefinition> {

const docsWorkspace = project.docsWorkspaces;
const apiWorkspaces = project.apiWorkspaces;
if (docsWorkspace == null) {
Expand All @@ -43,7 +43,7 @@ export async function getPreviewDocsDefinition({

if (editedAbsoluteFilepaths != null && previousDocsDefinition != null) {
const allMarkdownFiles = editedAbsoluteFilepaths.every(
(filepath) => filepath.endsWith('.mdx') || filepath.endsWith('.md')
(filepath) => filepath.endsWith(".mdx") || filepath.endsWith(".md")
);
for (const absoluteFilePath of editedAbsoluteFilepaths) {
const relativePath = relative(docsWorkspace.absoluteFilePath, absoluteFilePath);
Expand All @@ -52,18 +52,18 @@ export async function getPreviewDocsDefinition({
markdown,
absolutePathToFernFolder: docsWorkspace.absoluteFilePath,
absolutePathToMarkdownFile: absoluteFilePath,
context,
context
});

const previousValue = previousDocsDefinition.pages[FdrAPI.PageId(relativePath)];
if (previousValue == null) {
continue;
}

previousDocsDefinition.pages[FdrAPI.PageId(relativePath)] = {
markdown: processedMarkdown,
editThisPageUrl: previousValue.editThisPageUrl,
}
editThisPageUrl: previousValue.editThisPageUrl
};
}

if (allMarkdownFiles) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-preview/src/runPreviewServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export async function runPreviewServer({
project,
context,
previousDocsDefinition: docsDefinition,
editedAbsoluteFilepaths: editedAbsoluteFilepaths,
editedAbsoluteFilepaths: editedAbsoluteFilepaths

Check failure on line 141 in packages/cli/docs-preview/src/runPreviewServer.ts

View workflow job for this annotation

GitHub Actions / eslint

Expected property shorthand
});
context.logger.info(`Reload completed in ${Date.now() - startTime}ms`);
return newDocsDefinition;
Expand Down

0 comments on commit bab78be

Please sign in to comment.