@mintlify/cli 4.0.1129 → 4.0.1130
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/bin/cli.js +22 -0
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/cli.tsx +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1130",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@inquirer/prompts": "7.9.0",
|
|
48
48
|
"@mintlify/common": "1.0.861",
|
|
49
|
-
"@mintlify/link-rot": "3.0.
|
|
49
|
+
"@mintlify/link-rot": "3.0.1039",
|
|
50
50
|
"@mintlify/prebuild": "1.0.1004",
|
|
51
51
|
"@mintlify/previewing": "4.0.1065",
|
|
52
52
|
"@mintlify/validation": "0.1.672",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"vitest": "2.1.9",
|
|
94
94
|
"vitest-mock-process": "1.0.4"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "958b90219eb818715281541527518033f82e4f96"
|
|
97
97
|
}
|
package/src/cli.tsx
CHANGED
|
@@ -271,6 +271,11 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
|
|
|
271
271
|
type: 'boolean',
|
|
272
272
|
default: false,
|
|
273
273
|
description: 'also check links inside <Snippet> components',
|
|
274
|
+
})
|
|
275
|
+
.option('check-redirects', {
|
|
276
|
+
type: 'boolean',
|
|
277
|
+
default: false,
|
|
278
|
+
description: 'also check that docs.json redirect destinations resolve to valid paths',
|
|
274
279
|
}),
|
|
275
280
|
async (argv) => {
|
|
276
281
|
await autoUpgradeIfNeeded();
|
|
@@ -314,6 +319,25 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
|
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
321
|
|
|
322
|
+
if (argv['check-redirects']) {
|
|
323
|
+
const brokenRedirects = graph.getBrokenRedirects();
|
|
324
|
+
if (brokenRedirects.length > 0) {
|
|
325
|
+
const configFilename = await fs
|
|
326
|
+
.access(path.join(CMD_EXEC_PATH, 'docs.json'))
|
|
327
|
+
.then(() => 'docs.json')
|
|
328
|
+
.catch(() => 'mint.json');
|
|
329
|
+
const labels = brokenRedirects.map(
|
|
330
|
+
({ source, destination }) => `${source} → ${destination}`
|
|
331
|
+
);
|
|
332
|
+
const existing = brokenLinksByFile[configFilename];
|
|
333
|
+
if (existing) {
|
|
334
|
+
existing.push(...labels);
|
|
335
|
+
} else {
|
|
336
|
+
brokenLinksByFile[configFilename] = labels;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
317
341
|
if (Object.keys(brokenLinksByFile).length === 0) {
|
|
318
342
|
clearLogs();
|
|
319
343
|
addLog(<SuccessLog message="no broken links found" />);
|