@mintlify/cli 4.0.1045 → 4.0.1047
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.
|
@@ -103,6 +103,9 @@ describe('migrateMdx', () => {
|
|
|
103
103
|
const value = toPosixPath(
|
|
104
104
|
typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
|
|
105
105
|
);
|
|
106
|
+
if (value === '/project/docs.json') {
|
|
107
|
+
return JSON.stringify({ navigation: { pages: ['api/pets'] } });
|
|
108
|
+
}
|
|
106
109
|
if (value === '/project/api/pets.mdx') {
|
|
107
110
|
return `---\nopenapi: openapi.json GET /pets\n---\n\n# Title\nContent`;
|
|
108
111
|
}
|
|
@@ -183,6 +186,9 @@ describe('migrateMdx', () => {
|
|
|
183
186
|
const value = toPosixPath(
|
|
184
187
|
typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
|
|
185
188
|
);
|
|
189
|
+
if (value === '/project/docs.json') {
|
|
190
|
+
return JSON.stringify({ navigation: { pages: ['webhooks/newPet'] } });
|
|
191
|
+
}
|
|
186
192
|
if (value === '/project/webhooks/newPet.mdx') {
|
|
187
193
|
return `---\nopenapi: openapi1.json webhook newPet\n---\n\n# Webhook\nBody`;
|
|
188
194
|
}
|
|
@@ -25,8 +25,8 @@ export const accessibilityCheck = () => __awaiter(void 0, void 0, void 0, functi
|
|
|
25
25
|
return 1;
|
|
26
26
|
}
|
|
27
27
|
const configType = docsConfigPath ? 'docs' : 'mint';
|
|
28
|
-
const config = yield getConfigObj(CMD_EXEC_PATH, configType);
|
|
29
|
-
if (!config.colors) {
|
|
28
|
+
const config = (yield getConfigObj(CMD_EXEC_PATH, configType));
|
|
29
|
+
if (!(config === null || config === void 0 ? void 0 : config.colors)) {
|
|
30
30
|
addLog(_jsx(WarningLog, { message: "No colors section found in configuration file" }));
|
|
31
31
|
return 0;
|
|
32
32
|
}
|
package/bin/migrateMdx.js
CHANGED
|
@@ -65,6 +65,7 @@ export function migrateMdx() {
|
|
|
65
65
|
addLog(_jsx(ErrorLog, { message: "docs.json not found in current directory" }));
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
+
const rawConfig = JSON.parse(yield fs.promises.readFile(docsConfigPath, 'utf-8'));
|
|
68
69
|
const docsConfigObj = yield getConfigObj(CMD_EXEC_PATH, 'docs');
|
|
69
70
|
const validationResults = yield validateDocsConfig(docsConfigObj);
|
|
70
71
|
if (!validationResults.success) {
|
|
@@ -72,11 +73,10 @@ export function migrateMdx() {
|
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
75
|
const validatedDocsConfig = validationResults.data;
|
|
75
|
-
const docsConfig = docsConfigObj;
|
|
76
76
|
yield buildCandidateSpecCacheIfNeeded(CMD_EXEC_PATH);
|
|
77
77
|
const updatedNavigation = yield processNav(validatedDocsConfig.navigation);
|
|
78
|
-
|
|
79
|
-
yield outputFile(docsConfigPath, JSON.stringify(
|
|
78
|
+
rawConfig.navigation = updatedNavigation;
|
|
79
|
+
yield outputFile(docsConfigPath, JSON.stringify(rawConfig, null, 2));
|
|
80
80
|
addLog(_jsx(SuccessLog, { message: "docs.json updated" }));
|
|
81
81
|
for (const specPath in specCache) {
|
|
82
82
|
const specObj = specCache[specPath];
|