@mintlify/cli 4.0.1630 → 4.0.1632

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1630",
3
+ "version": "4.0.1632",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -45,12 +45,12 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
- "@mintlify/common": "1.0.1236",
49
- "@mintlify/link-rot": "3.0.1450",
48
+ "@mintlify/common": "1.0.1237",
49
+ "@mintlify/link-rot": "3.0.1452",
50
50
  "@mintlify/models": "0.0.372",
51
- "@mintlify/og": "0.0.34",
52
- "@mintlify/prebuild": "1.0.1397",
53
- "@mintlify/previewing": "4.0.1471",
51
+ "@mintlify/og": "0.0.35",
52
+ "@mintlify/prebuild": "1.0.1399",
53
+ "@mintlify/previewing": "4.0.1473",
54
54
  "@mintlify/validation": "0.1.909",
55
55
  "adm-zip": "0.6.0",
56
56
  "chalk": "5.2.0",
@@ -86,7 +86,7 @@
86
86
  "keytar": "7.9.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@mintlify/editor": "0.0.495",
89
+ "@mintlify/editor": "0.0.496",
90
90
  "@mintlify/ts-config": "2.0.2",
91
91
  "@tsconfig/recommended": "1.0.2",
92
92
  "@types/detect-port": "1.3.2",
@@ -105,5 +105,5 @@
105
105
  "vitest": "2.1.9",
106
106
  "vitest-mock-process": "1.0.4"
107
107
  },
108
- "gitHead": "090fc326376b5ffda3ae2d81321ed7ede279359c"
108
+ "gitHead": "c84411a4bba219c08bc232df2ed90ce9d2655273"
109
109
  }
package/src/cli.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { buildGraph, getBrokenExternalLinks } from '@mintlify/link-rot';
1
+ import { buildGraph, getBrokenExternalLinks, getFilesLinksDependOn } from '@mintlify/link-rot';
2
2
  import {
3
3
  addLog,
4
4
  dev,
@@ -387,10 +387,29 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
387
387
  )
388
388
  )
389
389
  : undefined;
390
+ // One unparseable page shouldn't hide every other result: report it and keep going
391
+ const parseErrorsByFile = new Map<string, string>();
390
392
  const graph = await buildGraph(docsRoot, {
391
393
  checkSnippets: argv['check-snippets'],
394
+ onParseError: (filePath, error) => parseErrorsByFile.set(filePath, error.message),
392
395
  });
393
396
  graph.precomputeFileResolutions();
397
+ // With --files, a failure elsewhere only matters when a selected link needs that
398
+ // file: an anchor pointing at it, or a snippet the selected page renders
399
+ const dependencies = sourceFiles
400
+ ? getFilesLinksDependOn(graph, sourceFiles, {
401
+ checkAnchors: argv['check-anchors'],
402
+ checkSnippets: argv['check-snippets'],
403
+ })
404
+ : undefined;
405
+ const parseErrors = [...parseErrorsByFile]
406
+ .filter(
407
+ ([filePath]) =>
408
+ !sourceFiles ||
409
+ sourceFiles.has(filePath) ||
410
+ dependencies?.has(filePath.split(path.sep).join('/'))
411
+ )
412
+ .map(([, message]) => message);
394
413
 
395
414
  const brokenInternalLinks = graph
396
415
  .getBrokenInternalLinks({
@@ -452,14 +471,29 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
452
471
  }
453
472
  }
454
473
 
455
- if (Object.keys(brokenLinksByFile).length === 0) {
474
+ const hasBrokenLinks = Object.keys(brokenLinksByFile).length > 0;
475
+ if (!hasBrokenLinks && parseErrors.length === 0) {
456
476
  clearLogs();
457
477
  addLog(<SuccessLog message="no broken links found" />);
458
478
  await terminate(0);
459
479
  }
460
480
 
461
481
  clearLogs();
462
- addLog(<BrokenLinksLog brokenLinksByFile={brokenLinksByFile} />);
482
+ if (hasBrokenLinks) {
483
+ addLog(<BrokenLinksLog brokenLinksByFile={brokenLinksByFile} />);
484
+ } else {
485
+ addLog(<SuccessLog message="no broken links found in the files that parsed" />);
486
+ }
487
+ for (const message of parseErrors) {
488
+ addLog(<ErrorLog message={message} />);
489
+ }
490
+ if (parseErrors.length > 0) {
491
+ addLog(
492
+ <WarningLog
493
+ message={`skipped ${parseErrors.length} file(s) that could not be parsed; links in them were not checked`}
494
+ />
495
+ );
496
+ }
463
497
  } catch (err) {
464
498
  addLog(<ErrorLog message={err instanceof Error ? err.message : 'unknown error'} />);
465
499
  await terminate(1);