@mintlify/prebuild 1.0.317 → 1.0.318
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.
- package/dist/prebuild/update/ConfigUpdater.d.ts +2185 -0
- package/dist/prebuild/update/ConfigUpdater.js +93 -0
- package/dist/prebuild/update/docsConfig/generateOpenApiDivisions.d.ts +15 -0
- package/dist/prebuild/update/docsConfig/generateOpenApiDivisions.js +129 -0
- package/dist/prebuild/update/docsConfig/index.d.ts +1939 -0
- package/dist/prebuild/update/docsConfig/index.js +17 -0
- package/dist/prebuild/update/index.d.ts +1 -0
- package/dist/prebuild/update/index.js +1 -0
- package/dist/prebuild/update/mintConfig/generateOpenApiAnchorsOrTabs.js +2 -2
- package/dist/prebuild/update/mintConfig/index.d.ts +242 -2
- package/dist/prebuild/update/mintConfig/index.js +6 -29
- package/dist/prebuild/update/read/getOpenApiFilesFromConfig.d.ts +5 -0
- package/dist/prebuild/update/read/getOpenApiFilesFromConfig.js +30 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/dist/prebuild/update/mintConfig/validateMintJson.d.ts +0 -241
- package/dist/prebuild/update/mintConfig/validateMintJson.js +0 -32
- package/dist/prebuild/update/read/getOpenApiFilesFromMintConfig.d.ts +0 -2
- package/dist/prebuild/update/read/getOpenApiFilesFromMintConfig.js +0 -15
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getConfigPath } from '../../../utils.js';
|
|
2
|
+
import { DocsConfigUpdater } from '../ConfigUpdater.js';
|
|
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) {
|
|
7
|
+
const configPath = await getConfigPath(contentDirectoryPath, 'docs');
|
|
8
|
+
if (configPath == null) {
|
|
9
|
+
throw Error('Must be run in a directory where a docs.json file exists.');
|
|
10
|
+
}
|
|
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 };
|
|
16
|
+
}
|
|
17
|
+
export { generateOpenApiDivisions } from './generateOpenApiDivisions.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getOpenApiDocumentFromUrl } from '@mintlify/common';
|
|
2
2
|
import { generateOpenApiPages } from '@mintlify/scraping';
|
|
3
3
|
import * as path from 'path';
|
|
4
|
-
import {
|
|
4
|
+
import { getOpenApiFilesFromConfig } from '../read/getOpenApiFilesFromConfig.js';
|
|
5
5
|
export const generateOpenApiAnchorsOrTabs = async (mintConfig, openApiFiles, targetDir) => {
|
|
6
|
-
const openapiFilesFromMintConfig = await
|
|
6
|
+
const openapiFilesFromMintConfig = await getOpenApiFilesFromConfig('mint', mintConfig);
|
|
7
7
|
openApiFiles.push(...openapiFilesFromMintConfig);
|
|
8
8
|
const pagesAcc = {};
|
|
9
9
|
const [anchorOpenApiInfo, tabOpenApiInfo] = await Promise.all([
|
|
@@ -1,9 +1,249 @@
|
|
|
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>;
|
|
2
244
|
export declare function updateMintConfigFile(contentDirectoryPath: string, openApiFiles: OpenApiFile[]): Promise<{
|
|
3
245
|
mintConfig: MintConfig;
|
|
4
246
|
pagesAcc: Record<string, DecoratedNavigationPage>;
|
|
5
247
|
openApiFiles: OpenApiFile[];
|
|
6
248
|
}>;
|
|
7
|
-
export declare const writeMintConfigFile: (deploymentConfig: MintConfig, targetDir?: string) => Promise<void>;
|
|
8
|
-
export { validateMintJson } from './validateMintJson.js';
|
|
9
249
|
export { generateOpenApiAnchorsOrTabs, generateOpenApiAnchorOrTab, } from './generateOpenApiAnchorsOrTabs.js';
|
|
@@ -1,40 +1,17 @@
|
|
|
1
|
-
import { promises as _promises } from 'fs';
|
|
2
|
-
import fse from 'fs-extra';
|
|
3
|
-
import { join } from 'path';
|
|
4
1
|
import { getConfigPath } from '../../../utils.js';
|
|
2
|
+
import { MintConfigUpdater } from '../ConfigUpdater.js';
|
|
5
3
|
import { generateOpenApiAnchorsOrTabs } from './generateOpenApiAnchorsOrTabs.js';
|
|
6
|
-
|
|
7
|
-
const
|
|
4
|
+
export const validateMintJson = MintConfigUpdater.validateMintConfigJson;
|
|
5
|
+
export const writeMintConfigFile = MintConfigUpdater.writeConfigFile;
|
|
8
6
|
export async function updateMintConfigFile(contentDirectoryPath, openApiFiles) {
|
|
9
7
|
const configPath = await getConfigPath(contentDirectoryPath, 'mint');
|
|
10
8
|
if (configPath == null) {
|
|
11
9
|
throw Error('Must be run in a directory where a mint.json file exists.');
|
|
12
10
|
}
|
|
13
|
-
const mintConfigContents = await
|
|
14
|
-
const validationResults = await
|
|
11
|
+
const mintConfigContents = await MintConfigUpdater.readConfigFile(configPath);
|
|
12
|
+
const validationResults = await MintConfigUpdater.validateMintConfigJson(mintConfigContents);
|
|
15
13
|
const { mintConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiAnchorsOrTabs(validationResults.data, openApiFiles);
|
|
16
|
-
await
|
|
14
|
+
await MintConfigUpdater.writeConfigFile(mintConfig);
|
|
17
15
|
return { mintConfig, pagesAcc, openApiFiles: newOpenApiFiles };
|
|
18
16
|
}
|
|
19
|
-
const readMintConfigFile = async (configPath) => {
|
|
20
|
-
let configContents;
|
|
21
|
-
try {
|
|
22
|
-
configContents = await readFile(configPath, 'utf-8');
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
throw Error(`Unable to read mint.json: ${err}`);
|
|
26
|
-
}
|
|
27
|
-
return configContents;
|
|
28
|
-
};
|
|
29
|
-
export const writeMintConfigFile = async (deploymentConfig, targetDir) => {
|
|
30
|
-
try {
|
|
31
|
-
await fse.outputFile(join(targetDir ?? '', 'src/_props/mint.json'), JSON.stringify(deploymentConfig, null, 2), {
|
|
32
|
-
flag: 'w',
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
throw Error(`Unable to write mint.json: ${err}`);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export { validateMintJson } from './validateMintJson.js';
|
|
40
17
|
export { generateOpenApiAnchorsOrTabs, generateOpenApiAnchorOrTab, } from './generateOpenApiAnchorsOrTabs.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ConfigType, MintConfig, OpenApiFile } from '@mintlify/models';
|
|
2
|
+
import { DocsConfig } from '@mintlify/validation';
|
|
3
|
+
type ConfigInput<T extends ConfigType> = T extends 'docs' ? DocsConfig : MintConfig;
|
|
4
|
+
export declare const getOpenApiFilesFromConfig: <T extends ConfigType>(type: T, config: ConfigInput<T>) => Promise<OpenApiFile[]>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getOpenApiDocumentFromUrl } from '@mintlify/common';
|
|
2
|
+
export const getOpenApiFilesFromConfig = async (type, config) => {
|
|
3
|
+
let openapi;
|
|
4
|
+
if (type === 'docs') {
|
|
5
|
+
openapi = config.api?.openapi;
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
openapi = config.openapi;
|
|
9
|
+
}
|
|
10
|
+
const openApiFiles = [];
|
|
11
|
+
// Download OpenApi file if url is provided
|
|
12
|
+
async function addOpenApiFileFromUrl(openapi) {
|
|
13
|
+
const specFromUrl = await getOpenApiDocumentFromUrl(openapi);
|
|
14
|
+
openApiFiles.push({
|
|
15
|
+
filename: 'openapi-from-url',
|
|
16
|
+
spec: specFromUrl,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (openapi) {
|
|
20
|
+
if (typeof openapi === 'string' && openapi.startsWith('https')) {
|
|
21
|
+
await addOpenApiFileFromUrl(openapi);
|
|
22
|
+
}
|
|
23
|
+
else if (typeof openapi === 'object' &&
|
|
24
|
+
'source' in openapi &&
|
|
25
|
+
openapi.source.startsWith('http')) {
|
|
26
|
+
await addOpenApiFileFromUrl(openapi.source);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return openApiFiles;
|
|
30
|
+
};
|