@mintlify/cli 4.0.1729 → 4.0.1731

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.1729",
3
+ "version": "4.0.1731",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
- "@mintlify/common": "1.0.1302",
49
- "@mintlify/link-rot": "3.0.1529",
50
- "@mintlify/models": "0.0.378",
51
- "@mintlify/og": "0.0.101",
52
- "@mintlify/prebuild": "1.0.1468",
53
- "@mintlify/previewing": "4.0.1547",
54
- "@mintlify/validation": "0.1.943",
48
+ "@mintlify/common": "1.0.1304",
49
+ "@mintlify/link-rot": "3.0.1531",
50
+ "@mintlify/models": "0.0.379",
51
+ "@mintlify/og": "0.0.103",
52
+ "@mintlify/prebuild": "1.0.1470",
53
+ "@mintlify/previewing": "4.0.1549",
54
+ "@mintlify/validation": "0.1.944",
55
55
  "adm-zip": "0.6.0",
56
56
  "chalk": "5.2.0",
57
57
  "color": "4.2.3",
@@ -82,7 +82,7 @@
82
82
  "keytar": "7.9.0"
83
83
  },
84
84
  "devDependencies": {
85
- "@mintlify/editor": "0.0.574",
85
+ "@mintlify/editor": "0.0.576",
86
86
  "@mintlify/ts-config": "2.0.2",
87
87
  "@tsconfig/recommended": "1.0.2",
88
88
  "@types/detect-port": "1.3.2",
@@ -101,5 +101,5 @@
101
101
  "vitest": "2.1.9",
102
102
  "vitest-mock-process": "1.0.4"
103
103
  },
104
- "gitHead": "b9727763d90b1858af01529dd7ff10648278bda2"
104
+ "gitHead": "8633bf3a3df756b5de637bf2c452093f5e397a6d"
105
105
  }
@@ -60,25 +60,41 @@ export const buildOverlayRegistryForCheck = async (
60
60
  });
61
61
  };
62
62
 
63
+ export type OpenApiCheckMessage = { level: 'success' | 'warning' | 'error'; message: string };
64
+
65
+ const logOpenApiMessage = ({ level, message }: OpenApiCheckMessage) => {
66
+ addLog(
67
+ level === 'success' ? (
68
+ <SuccessLog message={message} />
69
+ ) : level === 'warning' ? (
70
+ <WarningLog message={message} />
71
+ ) : (
72
+ <ErrorLog message={message} />
73
+ )
74
+ );
75
+ };
76
+
63
77
  export const checkOpenApiFile = async (
64
78
  filename: string,
65
79
  localSchema: boolean,
66
- overlayRegistry?: OverlayRegistry
80
+ overlayRegistry?: OverlayRegistry,
81
+ report: (message: OpenApiCheckMessage) => void = logOpenApiMessage
67
82
  ): Promise<boolean> => {
68
83
  try {
69
84
  const overlays = overlayRegistry ? await resolveOverlaysForSpec(overlayRegistry, filename) : [];
70
85
 
71
86
  if (isAllowedLocalSchemaUrl(filename, localSchema)) {
72
87
  await getOpenApiDocumentFromUrl(filename, { overlays });
73
- addLog(<SuccessLog message="OpenAPI definition is valid." />);
88
+ report({ level: 'success', message: 'OpenAPI definition is valid.' });
74
89
  return true;
75
90
  }
76
91
 
77
92
  if (filename.startsWith('http://') && !localSchema) {
78
- addLog(
79
- <WarningLog message="include the --local-schema flag to check locally hosted OpenAPI files" />
80
- );
81
- addLog(<WarningLog message="only https protocol is supported in production" />);
93
+ report({
94
+ level: 'warning',
95
+ message: 'include the --local-schema flag to check locally hosted OpenAPI files',
96
+ });
97
+ report({ level: 'warning', message: 'only https protocol is supported in production' });
82
98
  return true;
83
99
  }
84
100
 
@@ -93,13 +109,16 @@ export const checkOpenApiFile = async (
93
109
  throw new Error('applying overlays produced an invalid OpenAPI document.');
94
110
  }
95
111
  await validate(overlaid);
96
- addLog(<SuccessLog message="OpenAPI definition is valid." />);
112
+ report({ level: 'success', message: 'OpenAPI definition is valid.' });
97
113
  return true;
98
114
  } catch (err) {
99
115
  if (err && typeof err === 'object' && 'code' in err && err.code === 'ENOENT') {
100
- addLog(<ErrorLog message={`file not found, please check the path provided: ${filename}`} />);
116
+ report({
117
+ level: 'error',
118
+ message: `file not found, please check the path provided: ${filename}`,
119
+ });
101
120
  } else {
102
- addLog(<ErrorLog message={err instanceof Error ? err.message : 'unknown error'} />);
121
+ report({ level: 'error', message: err instanceof Error ? err.message : 'unknown error' });
103
122
  }
104
123
  return false;
105
124
  }