@mintlify/prebuild 1.0.318 → 1.0.320

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,19 @@
1
1
  import { getConfigPath } from '../../../utils.js';
2
2
  import { DocsConfigUpdater } from '../ConfigUpdater.js';
3
3
  import { generateOpenApiDivisions } from './generateOpenApiDivisions.js';
4
- export const validateDocsJson = DocsConfigUpdater.validateDocsConfigJson;
5
- export const writeDocsConfigFile = DocsConfigUpdater.writeConfigFile;
6
- export async function updateDocsConfigFile(contentDirectoryPath, openApiFiles) {
4
+ export async function updateDocsConfigFile(contentDirectoryPath, openApiFiles, docsConfig) {
7
5
  const configPath = await getConfigPath(contentDirectoryPath, 'docs');
8
- if (configPath == null) {
6
+ if (configPath == null && docsConfig == null) {
9
7
  throw Error('Must be run in a directory where a docs.json file exists.');
10
8
  }
11
- const docsConfigContents = await DocsConfigUpdater.readConfigFile(configPath);
12
- const validationResults = await DocsConfigUpdater.validateDocsConfigJson(docsConfigContents);
13
- const { newDocsConfig: docsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiDivisions(validationResults.data, openApiFiles);
14
- await DocsConfigUpdater.writeConfigFile(docsConfig);
15
- return { docsConfig, pagesAcc, openApiFiles: newOpenApiFiles };
9
+ if (docsConfig == null && configPath) {
10
+ docsConfig = await DocsConfigUpdater.getConfig(configPath);
11
+ }
12
+ if (docsConfig == null) {
13
+ throw Error('Must be run in a directory where a docs.json file exists.');
14
+ }
15
+ const { newDocsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiDivisions(docsConfig, openApiFiles);
16
+ await DocsConfigUpdater.writeConfigFile(newDocsConfig);
17
+ return { docsConfig: newDocsConfig, pagesAcc, newOpenApiFiles };
16
18
  }
17
19
  export { generateOpenApiDivisions } from './generateOpenApiDivisions.js';
@@ -1,8 +1,9 @@
1
- import type { ConfigType, OpenApiFile } from '@mintlify/models';
2
- export declare const update: (contentDirectoryPath: string, staticFilenames: string[], openApiFiles: OpenApiFile[], contentFilenames: string[], snippets: string[], snippetV2Filenames: string[], configType?: ConfigType) => Promise<import("@mintlify/models").MintConfig>;
1
+ import type { OpenApiFile } from '@mintlify/models';
2
+ export declare const update: (contentDirectoryPath: string, staticFilenames: string[], openApiFiles: OpenApiFile[], contentFilenames: string[], snippets: string[], snippetV2Filenames: string[], docsConfigPath?: string | null) => Promise<import("@mintlify/models").MintConfig>;
3
3
  export declare const writeMdxFilesWithNoImports: (mdxFilesWithNoImports: {
4
4
  targetPath: string;
5
5
  fileContent: string;
6
6
  }[]) => Promise<void>[];
7
7
  export * from './mintConfig/index.js';
8
8
  export * from './docsConfig/index.js';
9
+ export * from './ConfigUpdater.js';
@@ -1,14 +1,18 @@
1
+ import { upgradeToDocsConfig } from '@mintlify/validation';
1
2
  import { outputFile } from 'fs-extra';
3
+ import { updateDocsConfigFile } from './docsConfig/index.js';
2
4
  import { updateMintConfigFile } from './mintConfig/index.js';
3
5
  import { readPageContents, readSnippetsV2Contents } from './read/readContent.js';
4
6
  import { resolveImportsAndWriteFiles } from './resolveImportsAndWriteFiles.js';
5
7
  import { updateFavicons } from './updateFavicons.js';
6
- import { updateGeneratedNav } from './updateGeneratedNav.js';
8
+ import { updateGeneratedDocsNav, updateGeneratedNav } from './updateGeneratedNav.js';
7
9
  import { writeFiles } from './write/writeFiles.js';
8
10
  import { writeOpenApiFiles } from './write/writeOpenApiFiles.js';
9
- export const update = async (contentDirectoryPath, staticFilenames, openApiFiles, contentFilenames, snippets, snippetV2Filenames, configType = 'mint') => {
10
- const { mintConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await updateMintConfigFile(contentDirectoryPath, openApiFiles);
11
- const pagePromises = readPageContents(contentDirectoryPath, openApiFiles, contentFilenames, pagesAcc);
11
+ export const update = async (contentDirectoryPath, staticFilenames, openApiFiles, contentFilenames, snippets, snippetV2Filenames, docsConfigPath) => {
12
+ const { mintConfig } = await updateMintConfigFile(contentDirectoryPath, openApiFiles);
13
+ const docsConfig = upgradeToDocsConfig(mintConfig);
14
+ const { docsConfig: newDocsConfig, pagesAcc, newOpenApiFiles, } = await updateDocsConfigFile(contentDirectoryPath, openApiFiles, docsConfigPath ? undefined : docsConfig);
15
+ const pagePromises = readPageContents(contentDirectoryPath, newOpenApiFiles, contentFilenames, pagesAcc);
12
16
  const snippetV2Promises = readSnippetsV2Contents(contentDirectoryPath, snippetV2Filenames);
13
17
  const [snippetV2Contents, { mdxFilesWithNoImports, filesWithImports }] = await Promise.all([
14
18
  snippetV2Promises,
@@ -21,13 +25,8 @@ export const update = async (contentDirectoryPath, staticFilenames, openApiFiles
21
25
  ...writeMdxFilesWithNoImports(mdxFilesWithNoImports),
22
26
  ...writeFiles(contentDirectoryPath, 'public', [...staticFilenames, ...snippets]),
23
27
  ]);
24
- if (configType === 'docs') {
25
- // TODO: after merging the docs openapi PR
26
- // await updateGeneratedDocsNav(pagesAcc, docsConfig.navigation);
27
- }
28
- else {
29
- await updateGeneratedNav(pagesAcc, mintConfig.navigation);
30
- }
28
+ await updateGeneratedDocsNav(pagesAcc, newDocsConfig.navigation);
29
+ await updateGeneratedNav(pagesAcc, mintConfig.navigation);
31
30
  return mintConfig;
32
31
  };
33
32
  export const writeMdxFilesWithNoImports = (mdxFilesWithNoImports) => {
@@ -40,3 +39,4 @@ export const writeMdxFilesWithNoImports = (mdxFilesWithNoImports) => {
40
39
  };
41
40
  export * from './mintConfig/index.js';
42
41
  export * from './docsConfig/index.js';
42
+ export * from './ConfigUpdater.js';
@@ -1,246 +1,4 @@
1
1
  import { DecoratedNavigationPage, MintConfig, OpenApiFile } from '@mintlify/models';
2
- export declare const validateMintJson: (configContents: string) => Promise<{
3
- warnings: import("zod").ZodIssue[];
4
- success: true;
5
- data: {
6
- name: string;
7
- $schema: string;
8
- favicon: string;
9
- colors: {
10
- primary: string;
11
- light?: string | undefined;
12
- dark?: string | undefined;
13
- background?: {
14
- light?: string | undefined;
15
- dark?: string | undefined;
16
- } | undefined;
17
- anchors?: string | {
18
- from: string;
19
- to: string;
20
- via?: string | undefined;
21
- } | undefined;
22
- ultraLight?: any;
23
- ultraDark?: any;
24
- };
25
- navigation: import("@mintlify/models").NavigationGroup[];
26
- mintlify?: string | undefined;
27
- logo?: string | {
28
- light: string;
29
- dark: string;
30
- href?: string | undefined;
31
- } | undefined;
32
- theme?: "venus" | "quill" | "prism" | undefined;
33
- layout?: "topnav" | "sidenav" | "solidSidenav" | undefined;
34
- openapi?: string | string[] | undefined;
35
- topbar?: {
36
- style?: "gradient" | "default" | undefined;
37
- } | undefined;
38
- sidebar?: {
39
- items?: "container" | "card" | "border" | "undecorated" | undefined;
40
- } | undefined;
41
- rounded?: "default" | "sharp" | undefined;
42
- api?: {
43
- baseUrl?: string | string[] | undefined;
44
- auth?: {
45
- method?: "key" | "bearer" | "basic" | "cobo" | undefined;
46
- name?: string | undefined;
47
- inputPrefix?: string | undefined;
48
- } | undefined;
49
- playground?: {
50
- mode: "show" | "simple" | "hide";
51
- disableProxy?: boolean | undefined;
52
- } | undefined;
53
- request?: {
54
- example?: {
55
- showOptionalParams?: boolean | undefined;
56
- languages?: string[] | undefined;
57
- } | undefined;
58
- } | undefined;
59
- maintainOrder?: boolean | undefined;
60
- paramFields?: {
61
- expanded?: "all" | "topLevel" | "topLevelOneOfs" | "none" | undefined;
62
- } | undefined;
63
- } | undefined;
64
- modeToggle?: {
65
- default?: "light" | "dark" | undefined;
66
- isHidden?: boolean | undefined;
67
- } | undefined;
68
- versions?: (string | {
69
- name: string;
70
- url?: string | undefined;
71
- default?: true | undefined;
72
- locale?: "en" | "cn" | "es" | "fr" | "jp" | "pt" | "pt-BR" | "de" | undefined;
73
- })[] | undefined;
74
- metadata?: Record<string, string> | undefined;
75
- codeBlock?: {
76
- mode?: "dark" | "auto" | undefined;
77
- } | undefined;
78
- eyebrow?: {
79
- display?: "section" | "breadcrumbs" | undefined;
80
- } | undefined;
81
- topbarCtaButton?: {
82
- name: string;
83
- url: string;
84
- type?: "link" | undefined;
85
- style?: "pill" | "roundedRectangle" | undefined;
86
- arrow?: boolean | undefined;
87
- } | {
88
- type: "github";
89
- url: string;
90
- } | undefined;
91
- topbarLinks?: ({
92
- name: string;
93
- url: string;
94
- type?: "link" | undefined;
95
- style?: "pill" | "roundedRectangle" | undefined;
96
- arrow?: boolean | undefined;
97
- } | {
98
- type: "github";
99
- url: string;
100
- })[] | undefined;
101
- primaryTab?: {
102
- name: string;
103
- isDefaultHidden?: boolean | undefined;
104
- } | undefined;
105
- topAnchor?: {
106
- name: string;
107
- icon?: string | undefined;
108
- iconType?: "brands" | "duotone" | "light" | "regular" | "sharp-duotone-solid" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
109
- } | undefined;
110
- anchors?: {
111
- name: string;
112
- url: string;
113
- icon?: string | undefined;
114
- iconType?: "brands" | "duotone" | "light" | "regular" | "sharp-duotone-solid" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
115
- color?: string | {
116
- from: string;
117
- to: string;
118
- via?: string | undefined;
119
- } | undefined;
120
- isDefaultHidden?: boolean | undefined;
121
- version?: string | undefined;
122
- openapi?: string | undefined;
123
- }[] | undefined;
124
- tabs?: {
125
- name: string;
126
- url: string;
127
- version?: string | undefined;
128
- isDefaultHidden?: boolean | undefined;
129
- openapi?: string | undefined;
130
- }[] | undefined;
131
- footer?: {
132
- socials?: Partial<Record<"github" | "x" | "website" | "facebook" | "youtube" | "discord" | "slack" | "linkedin" | "instagram" | "hacker-news" | "medium" | "telegram" | "twitter", string>> | {
133
- type: "github" | "x" | "website" | "facebook" | "youtube" | "discord" | "slack" | "linkedin" | "instagram" | "hacker-news" | "medium" | "telegram" | "twitter";
134
- url: string;
135
- }[] | undefined;
136
- links?: {
137
- links: {
138
- url: string;
139
- label: string;
140
- }[];
141
- title?: string | undefined;
142
- }[] | undefined;
143
- } | undefined;
144
- background?: {
145
- style?: "gradient" | "grid" | "windows" | undefined;
146
- } | undefined;
147
- backgroundImage?: string | undefined;
148
- font?: {
149
- family: string;
150
- weight?: number | undefined;
151
- url?: string | undefined;
152
- format?: "woff" | "woff2" | undefined;
153
- } | {
154
- headings?: {
155
- family: string;
156
- weight?: number | undefined;
157
- url?: string | undefined;
158
- format?: "woff" | "woff2" | undefined;
159
- } | undefined;
160
- body?: {
161
- family: string;
162
- weight?: number | undefined;
163
- url?: string | undefined;
164
- format?: "woff" | "woff2" | undefined;
165
- } | undefined;
166
- } | undefined;
167
- feedback?: {
168
- thumbsRating?: boolean | undefined;
169
- suggestEdit?: boolean | undefined;
170
- raiseIssue?: boolean | undefined;
171
- } | undefined;
172
- analytics?: {
173
- amplitude?: {
174
- apiKey: string;
175
- } | undefined;
176
- clearbit?: {
177
- publicApiKey: string;
178
- } | undefined;
179
- fathom?: {
180
- siteId: string;
181
- } | undefined;
182
- ga4?: {
183
- measurementId: string;
184
- } | undefined;
185
- gtm?: {
186
- tagId: string;
187
- } | undefined;
188
- heap?: {
189
- appId: string;
190
- } | undefined;
191
- hotjar?: {
192
- hjid: string;
193
- hjsv: string;
194
- } | undefined;
195
- koala?: {
196
- publicApiKey: string;
197
- } | undefined;
198
- logrocket?: {
199
- appId: string;
200
- } | undefined;
201
- mixpanel?: {
202
- projectToken: string;
203
- } | undefined;
204
- pirsch?: {
205
- id: string;
206
- } | undefined;
207
- posthog?: {
208
- apiKey: string;
209
- apiHost?: string | undefined;
210
- } | undefined;
211
- plausible?: {
212
- domain: string;
213
- server?: string | undefined;
214
- } | undefined;
215
- segment?: {
216
- key: string;
217
- } | undefined;
218
- } | undefined;
219
- integrations?: {
220
- intercom?: string | undefined;
221
- frontchat?: string | undefined;
222
- osano?: string | undefined;
223
- } | undefined;
224
- isWhiteLabeled?: boolean | undefined;
225
- search?: {
226
- prompt?: string | undefined;
227
- location?: "side" | "top" | undefined;
228
- } | undefined;
229
- redirects?: {
230
- source: string;
231
- destination: string;
232
- permanent?: boolean | undefined;
233
- }[] | undefined;
234
- seo?: {
235
- indexHiddenPages?: boolean | undefined;
236
- } | undefined;
237
- footerSocials?: Partial<Record<"github" | "x" | "website" | "facebook" | "youtube" | "discord" | "slack" | "linkedin" | "instagram" | "hacker-news" | "medium" | "telegram" | "twitter", string>> | {
238
- type: "github" | "x" | "website" | "facebook" | "youtube" | "discord" | "slack" | "linkedin" | "instagram" | "hacker-news" | "medium" | "telegram" | "twitter";
239
- url: string;
240
- }[] | undefined;
241
- };
242
- }>;
243
- export declare const writeMintConfigFile: (config: MintConfig | import("@mintlify/validation").DocsConfig, targetDir?: string) => Promise<void>;
244
2
  export declare function updateMintConfigFile(contentDirectoryPath: string, openApiFiles: OpenApiFile[]): Promise<{
245
3
  mintConfig: MintConfig;
246
4
  pagesAcc: Record<string, DecoratedNavigationPage>;
@@ -1,17 +1,14 @@
1
1
  import { getConfigPath } from '../../../utils.js';
2
2
  import { MintConfigUpdater } from '../ConfigUpdater.js';
3
3
  import { generateOpenApiAnchorsOrTabs } from './generateOpenApiAnchorsOrTabs.js';
4
- export const validateMintJson = MintConfigUpdater.validateMintConfigJson;
5
- export const writeMintConfigFile = MintConfigUpdater.writeConfigFile;
6
4
  export async function updateMintConfigFile(contentDirectoryPath, openApiFiles) {
7
5
  const configPath = await getConfigPath(contentDirectoryPath, 'mint');
8
6
  if (configPath == null) {
9
7
  throw Error('Must be run in a directory where a mint.json file exists.');
10
8
  }
11
- const mintConfigContents = await MintConfigUpdater.readConfigFile(configPath);
12
- const validationResults = await MintConfigUpdater.validateMintConfigJson(mintConfigContents);
13
- const { mintConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiAnchorsOrTabs(validationResults.data, openApiFiles);
14
- await MintConfigUpdater.writeConfigFile(mintConfig);
15
- return { mintConfig, pagesAcc, openApiFiles: newOpenApiFiles };
9
+ const mintConfig = await MintConfigUpdater.getConfig(configPath);
10
+ const { mintConfig: newMintConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiAnchorsOrTabs(mintConfig, openApiFiles);
11
+ await MintConfigUpdater.writeConfigFile(newMintConfig);
12
+ return { mintConfig: newMintConfig, pagesAcc, openApiFiles: newOpenApiFiles };
16
13
  }
17
14
  export { generateOpenApiAnchorsOrTabs, generateOpenApiAnchorOrTab, } from './generateOpenApiAnchorsOrTabs.js';