@mintlify/previewing 4.0.855 → 4.0.857
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/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LOCAL_LINKED_CLI_VERSION } from './constants.js';
|
|
2
2
|
import { getLatestClientVersion, downloadTargetMint, getVersionMap } from './local-preview/client.js';
|
|
3
3
|
import dev from './local-preview/index.js';
|
|
4
|
+
import validateBuild from './local-preview/validate-build.js';
|
|
4
5
|
import { getClientVersion } from './util.js';
|
|
5
6
|
export * from './logs.js';
|
|
6
7
|
export * from './logging-state.js';
|
|
7
|
-
export { dev, getClientVersion, getLatestClientVersion, downloadTargetMint, getVersionMap, LOCAL_LINKED_CLI_VERSION, };
|
|
8
|
+
export { dev, validateBuild, getClientVersion, getLatestClientVersion, downloadTargetMint, getVersionMap, LOCAL_LINKED_CLI_VERSION, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LOCAL_LINKED_CLI_VERSION } from './constants.js';
|
|
2
2
|
import { getLatestClientVersion, downloadTargetMint, getVersionMap, } from './local-preview/client.js';
|
|
3
3
|
import dev from './local-preview/index.js';
|
|
4
|
+
import validateBuild from './local-preview/validate-build.js';
|
|
4
5
|
import { getClientVersion } from './util.js';
|
|
5
6
|
export * from './logs.js';
|
|
6
7
|
export * from './logging-state.js';
|
|
7
|
-
export { dev, getClientVersion, getLatestClientVersion, downloadTargetMint, getVersionMap, LOCAL_LINKED_CLI_VERSION, };
|
|
8
|
+
export { dev, validateBuild, getClientVersion, getLatestClientVersion, downloadTargetMint, getVersionMap, LOCAL_LINKED_CLI_VERSION, };
|
|
@@ -7,7 +7,7 @@ export const getDocsState = async (onError) => {
|
|
|
7
7
|
const mintIgnore = await getMintIgnore(CMD_EXEC_PATH);
|
|
8
8
|
const { openApiFiles } = await categorizeFilePaths(CMD_EXEC_PATH, mintIgnore);
|
|
9
9
|
try {
|
|
10
|
-
const mintConfig = await MintConfigUpdater.getConfig(join(CMD_EXEC_PATH, 'mint.json'), onError);
|
|
10
|
+
const mintConfig = await MintConfigUpdater.getConfig(join(CMD_EXEC_PATH, 'mint.json'), false, onError);
|
|
11
11
|
const docsConfig = upgradeToDocsConfig(mintConfig);
|
|
12
12
|
const { mintConfig: newMintConfig } = await generateOpenApiAnchorsOrTabs(mintConfig, openApiFiles, CLIENT_PATH);
|
|
13
13
|
const { newDocsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiDivisions(docsConfig, openApiFiles, CLIENT_PATH);
|
|
@@ -22,7 +22,7 @@ export const getDocsState = async (onError) => {
|
|
|
22
22
|
const docsJsonPath = join(CMD_EXEC_PATH, 'docs.json');
|
|
23
23
|
if (!(await fse.pathExists(docsJsonPath)))
|
|
24
24
|
throw new Error('No config found');
|
|
25
|
-
const docsConfig = await DocsConfigUpdater.getConfig(docsJsonPath, onError);
|
|
25
|
+
const docsConfig = await DocsConfigUpdater.getConfig(docsJsonPath, false, onError);
|
|
26
26
|
const { newDocsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = await generateOpenApiDivisions(docsConfig, openApiFiles, CLIENT_PATH);
|
|
27
27
|
return { pagesAcc, openApiFiles: newOpenApiFiles, docsConfig: newDocsConfig };
|
|
28
28
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { prebuild } from '@mintlify/prebuild';
|
|
3
|
+
import fse, { pathExists } from 'fs-extra';
|
|
4
|
+
import isOnline from 'is-online';
|
|
5
|
+
import { CLIENT_PATH, DOT_MINTLIFY, CMD_EXEC_PATH, VERSION_PATH, NEXT_PUBLIC_PATH, NEXT_PROPS_PATH, } from '../constants.js';
|
|
6
|
+
import { addLog, clearLogs } from '../logging-state.js';
|
|
7
|
+
import { ErrorLog, SpinnerLog, SuccessLog } from '../logs.js';
|
|
8
|
+
import { silentUpdateClient } from './update.js';
|
|
9
|
+
const validateBuild = async (argv) => {
|
|
10
|
+
const hasInternet = await isOnline();
|
|
11
|
+
const localSchema = argv['local-schema'];
|
|
12
|
+
const clientVersion = argv['client-version'];
|
|
13
|
+
const packageName = argv.packageName;
|
|
14
|
+
const groups = argv.groups;
|
|
15
|
+
const cliVersion = argv.cliVersion;
|
|
16
|
+
const disableOpenApi = argv.disableOpenapi;
|
|
17
|
+
await fse.ensureDir(DOT_MINTLIFY);
|
|
18
|
+
const versionString = (await pathExists(VERSION_PATH))
|
|
19
|
+
? fse.readFileSync(VERSION_PATH, 'utf8')
|
|
20
|
+
: null;
|
|
21
|
+
if (!versionString && !hasInternet) {
|
|
22
|
+
clearLogs();
|
|
23
|
+
addLog(_jsx(ErrorLog, { message: `running ${packageName} validate-build after updating requires an internet connection.` }));
|
|
24
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
addLog(_jsx(SpinnerLog, { message: "validating build..." }));
|
|
28
|
+
const { error } = await silentUpdateClient({
|
|
29
|
+
versionString,
|
|
30
|
+
clientVersion,
|
|
31
|
+
cliVersion,
|
|
32
|
+
localClientVersion: undefined,
|
|
33
|
+
});
|
|
34
|
+
if (error) {
|
|
35
|
+
clearLogs();
|
|
36
|
+
addLog(_jsx(ErrorLog, { message: error }));
|
|
37
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
// clear preexisting prebuild files
|
|
41
|
+
fse.emptyDirSync(NEXT_PUBLIC_PATH);
|
|
42
|
+
fse.emptyDirSync(NEXT_PROPS_PATH);
|
|
43
|
+
process.chdir(CLIENT_PATH);
|
|
44
|
+
try {
|
|
45
|
+
await prebuild(CMD_EXEC_PATH, { localSchema, groups, disableOpenApi, strict: true });
|
|
46
|
+
clearLogs();
|
|
47
|
+
addLog(_jsx(SuccessLog, { message: "build validation passed" }));
|
|
48
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
clearLogs();
|
|
53
|
+
const errorText = err instanceof Error && err.message ? err.message : 'build validation failed';
|
|
54
|
+
addLog(_jsx(ErrorLog, { message: errorText }));
|
|
55
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
export default validateBuild;
|