1
+ import { readFile } from "fs/promises" ;
1
2
import { v4 as uuidv4 } from "uuid" ;
2
3
3
4
import { DocsDefinitionResolver , filterOssWorkspaces } from "@fern-api/docs-resolver" ;
4
5
import {
5
6
APIV1Read ,
6
7
APIV1Write ,
7
- convertAPIDefinitionToDb ,
8
- convertDbAPIDefinitionToRead ,
9
- convertDbDocsConfigToRead ,
10
- convertDocsDefinitionToDb ,
11
8
DocsV1Read ,
12
9
FdrAPI ,
13
10
FernNavigation ,
14
11
SDKSnippetHolder ,
12
+ convertAPIDefinitionToDb ,
13
+ convertDbAPIDefinitionToRead ,
14
+ convertDbDocsConfigToRead ,
15
+ convertDocsDefinitionToDb
15
16
} from "@fern-api/fdr-sdk" ;
16
17
import { AbsoluteFilePath , convertToFernHostAbsoluteFilePath , relative } from "@fern-api/fs-utils" ;
17
18
import { IntermediateRepresentation } from "@fern-api/ir-sdk" ;
18
19
import { Project } from "@fern-api/project-loader" ;
19
20
import { convertIrToFdrApi } from "@fern-api/register" ;
20
21
import { TaskContext } from "@fern-api/task-context" ;
21
- import { readFile } from "fs/promises" ;
22
+
22
23
import { replaceReferencedMarkdown } from "../../docs-markdown-utils/src" ;
23
24
24
25
export async function getPreviewDocsDefinition ( {
@@ -34,7 +35,6 @@ export async function getPreviewDocsDefinition({
34
35
previousDocsDefinition ?: DocsV1Read . DocsDefinition ;
35
36
editedAbsoluteFilepaths ?: AbsoluteFilePath [ ] ;
36
37
} ) : Promise < DocsV1Read . DocsDefinition > {
37
-
38
38
const docsWorkspace = project . docsWorkspaces ;
39
39
const apiWorkspaces = project . apiWorkspaces ;
40
40
if ( docsWorkspace == null ) {
@@ -43,7 +43,7 @@ export async function getPreviewDocsDefinition({
43
43
44
44
if ( editedAbsoluteFilepaths != null && previousDocsDefinition != null ) {
45
45
const allMarkdownFiles = editedAbsoluteFilepaths . every (
46
- ( filepath ) => filepath . endsWith ( ' .mdx' ) || filepath . endsWith ( ' .md' )
46
+ ( filepath ) => filepath . endsWith ( " .mdx" ) || filepath . endsWith ( " .md" )
47
47
) ;
48
48
for ( const absoluteFilePath of editedAbsoluteFilepaths ) {
49
49
const relativePath = relative ( docsWorkspace . absoluteFilePath , absoluteFilePath ) ;
@@ -52,18 +52,18 @@ export async function getPreviewDocsDefinition({
52
52
markdown,
53
53
absolutePathToFernFolder : docsWorkspace . absoluteFilePath ,
54
54
absolutePathToMarkdownFile : absoluteFilePath ,
55
- context,
55
+ context
56
56
} ) ;
57
-
57
+
58
58
const previousValue = previousDocsDefinition . pages [ FdrAPI . PageId ( relativePath ) ] ;
59
59
if ( previousValue == null ) {
60
60
continue ;
61
61
}
62
62
63
63
previousDocsDefinition . pages [ FdrAPI . PageId ( relativePath ) ] = {
64
64
markdown : processedMarkdown ,
65
- editThisPageUrl : previousValue . editThisPageUrl ,
66
- }
65
+ editThisPageUrl : previousValue . editThisPageUrl
66
+ } ;
67
67
}
68
68
69
69
if ( allMarkdownFiles ) {
0 commit comments