@mintlify/cli 4.0.1733 → 4.0.1734
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/__test__/validateCommand.test.ts +141 -0
- package/__test__/validateEngine.test.ts +46 -0
- package/__test__/validateRules.test.ts +500 -0
- package/bin/cli.js +21 -0
- package/bin/resolveFiles.js +3 -1
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/bin/validate/command.js +58 -0
- package/bin/validate/engine.js +76 -0
- package/bin/validate/files.js +148 -0
- package/bin/validate/mdx.js +201 -0
- package/bin/validate/output.js +28 -0
- package/bin/validate/rules/content/voidTags.js +35 -0
- package/bin/validate/rules/index.js +3 -0
- package/bin/validate/rules/parseError.js +7 -0
- package/bin/validate/site.js +55 -0
- package/bin/validate/types.js +1 -0
- package/package.json +8 -8
- package/src/cli.tsx +24 -0
- package/src/resolveFiles.ts +3 -1
- package/src/validate/command.tsx +71 -0
- package/src/validate/engine.ts +93 -0
- package/src/validate/files.ts +212 -0
- package/src/validate/mdx.ts +252 -0
- package/src/validate/output.tsx +56 -0
- package/src/validate/rules/content/voidTags.ts +35 -0
- package/src/validate/rules/index.ts +5 -0
- package/src/validate/rules/parseError.ts +9 -0
- package/src/validate/site.ts +52 -0
- package/src/validate/types.ts +88 -0
package/bin/cli.js
CHANGED
|
@@ -43,6 +43,7 @@ import { sendPublishPrompt, signup } from './signup.js';
|
|
|
43
43
|
import { status, getCliSubdomains } from './status.js';
|
|
44
44
|
import { trackTelemetryPreferenceChange } from './telemetry/track.js';
|
|
45
45
|
import { update } from './update.js';
|
|
46
|
+
import { runLintStep, splitList } from './validate/command.js';
|
|
46
47
|
import { renderWelcome } from './welcome.js';
|
|
47
48
|
import { workflowsBuilder } from './workflows/index.js';
|
|
48
49
|
// The branded welcome screen replaces yargs' default help, but only for an
|
|
@@ -303,9 +304,29 @@ export const cli = ({ packageName = 'mint' }) => {
|
|
|
303
304
|
type: 'boolean',
|
|
304
305
|
default: false,
|
|
305
306
|
description: 'Disable OpenAPI file generation',
|
|
307
|
+
})
|
|
308
|
+
.option('files', {
|
|
309
|
+
type: 'string',
|
|
310
|
+
array: true,
|
|
311
|
+
description: 'Limit page checks to these files or globs; site-wide checks and the build still cover the whole site',
|
|
312
|
+
})
|
|
313
|
+
.option('enable', {
|
|
314
|
+
type: 'string',
|
|
315
|
+
array: true,
|
|
316
|
+
coerce: splitList,
|
|
317
|
+
description: 'Turn on rules or groups (comma-separated), for example after --disable all',
|
|
318
|
+
})
|
|
319
|
+
.option('disable', {
|
|
320
|
+
type: 'string',
|
|
321
|
+
array: true,
|
|
322
|
+
coerce: splitList,
|
|
323
|
+
description: 'Turn off rules or groups (comma-separated), or all; parse errors are still reported',
|
|
306
324
|
})
|
|
307
325
|
.usage('usage: mintlify validate [options]')
|
|
308
326
|
.example('mintlify validate', 'validate the build'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
327
|
+
const lintPassed = yield runLintStep(argv);
|
|
328
|
+
if (!lintPassed)
|
|
329
|
+
return;
|
|
309
330
|
if (!argv['disable-openapi']) {
|
|
310
331
|
let openApiFilenames = [];
|
|
311
332
|
try {
|
package/bin/resolveFiles.js
CHANGED
|
@@ -79,6 +79,8 @@ function walk(baseDir_1) {
|
|
|
79
79
|
return files;
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
export class NoMatchingFilesError extends Error {
|
|
83
|
+
}
|
|
82
84
|
export function resolveExplicitFiles(baseDir, args) {
|
|
83
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
86
|
let allFiles = null;
|
|
@@ -105,7 +107,7 @@ export function resolveExplicitFiles(baseDir, args) {
|
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
if (unmatched.length > 0) {
|
|
108
|
-
throw new
|
|
110
|
+
throw new NoMatchingFilesError(`No matching files for: ${unmatched.join(', ')} (globs match .md and .mdx files)`);
|
|
109
111
|
}
|
|
110
112
|
return [...new Set(matched)];
|
|
111
113
|
});
|