@mintlify/cli 4.0.530 → 4.0.532
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 +16 -4
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/cli.ts +23 -9
package/bin/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { validate, getOpenApiDocumentFromUrl } from '@mintlify/common';
|
|
10
|
+
import { validate, getOpenApiDocumentFromUrl, isAllowedLocalSchemaUrl } from '@mintlify/common';
|
|
11
11
|
import { getBrokenInternalLinks, renameFilesAndUpdateLinksInContent } from '@mintlify/link-rot';
|
|
12
12
|
import { dev } from '@mintlify/previewing';
|
|
13
13
|
import Chalk from 'chalk';
|
|
@@ -24,6 +24,12 @@ export const cli = () => yargs(hideBin(process.argv))
|
|
|
24
24
|
type: 'boolean',
|
|
25
25
|
default: true,
|
|
26
26
|
description: 'Open Mintlify in the browser',
|
|
27
|
+
})
|
|
28
|
+
.option('local-schema', {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
default: false,
|
|
31
|
+
hidden: true,
|
|
32
|
+
description: 'Use a locally hosted schema file (note: only https protocol is supported in production)',
|
|
27
33
|
})
|
|
28
34
|
.usage('Usage: mintlify dev [options]')
|
|
29
35
|
.example('mintlify dev', 'Run with default settings (opens in browser)')
|
|
@@ -36,13 +42,19 @@ export const cli = () => yargs(hideBin(process.argv))
|
|
|
36
42
|
console.error(`No available port found.`);
|
|
37
43
|
}
|
|
38
44
|
}))
|
|
39
|
-
.command('openapi-check <openapiFilenameOrUrl>', 'Validate an OpenAPI spec', (yargs) => yargs
|
|
45
|
+
.command('openapi-check <openapiFilenameOrUrl>', 'Validate an OpenAPI spec', (yargs) => yargs
|
|
46
|
+
.positional('openapiFilenameOrUrl', {
|
|
40
47
|
describe: 'The filename of the OpenAPI spec (e.g. ./openapi.yaml) or the URL to the OpenAPI spec (e.g. https://petstore3.swagger.io/api/v3/openapi.json)',
|
|
41
48
|
type: 'string',
|
|
42
49
|
demandOption: true,
|
|
43
|
-
})
|
|
50
|
+
})
|
|
51
|
+
.option('local-schema', {
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
description: 'Use a locally hosted schema file (note: only https protocol is supported in production)',
|
|
55
|
+
}), (_a) => __awaiter(void 0, [_a], void 0, function* ({ openapiFilenameOrUrl, 'local-schema': localSchema }) {
|
|
44
56
|
try {
|
|
45
|
-
if (openapiFilenameOrUrl
|
|
57
|
+
if (isAllowedLocalSchemaUrl(openapiFilenameOrUrl, localSchema)) {
|
|
46
58
|
yield getOpenApiDocumentFromUrl(openapiFilenameOrUrl);
|
|
47
59
|
console.log('✅ Your OpenAPI definition is valid.');
|
|
48
60
|
process.exit(0);
|