@mintlify/previewing 4.0.358 → 4.0.360

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.
@@ -1,4 +1,4 @@
1
- export declare const TARGET_MINT_VERSION = "v0.0.816";
1
+ export declare const TARGET_MINT_VERSION = "v0.0.850";
2
2
  export declare const INSTALL_PATH: string;
3
3
  export declare const HOME_DIR: string;
4
4
  export declare const DOT_MINTLIFY: string;
package/dist/constants.js CHANGED
@@ -2,7 +2,7 @@ import os from 'os';
2
2
  import path from 'path';
3
3
  import * as url from 'url';
4
4
  // Change this to bump to a newer version of mint's client
5
- export const TARGET_MINT_VERSION = 'v0.0.816';
5
+ export const TARGET_MINT_VERSION = 'v0.0.850';
6
6
  // package installation location
7
7
  export const INSTALL_PATH = url.fileURLToPath(new URL('.', import.meta.url));
8
8
  export const HOME_DIR = os.homedir();
@@ -1,74 +1,6 @@
1
- import type { DecoratedNavigationPage } from '@mintlify/models';
1
+ import type { DecoratedNavigation, DecoratedNavigationPage } from '@mintlify/models';
2
+ import { DecoratedNavigationConfig } from '@mintlify/validation';
2
3
  export declare const generateNav: (pagesAcc: Record<string, DecoratedNavigationPage>) => Promise<{
3
- generatedNav: import("@mintlify/models").DecoratedNavigation;
4
- generatedDocsNav: ({
5
- languages: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").LanguageNavigation<"decorated">[];
6
- } | {
7
- versions: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").VersionNavigation<"decorated">[];
8
- } | {
9
- tabs: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").TabNavigation<"decorated">[];
10
- } | {
11
- dropdowns: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").DropdownNavigation<"decorated">[];
12
- } | {
13
- anchors: import("@mintlify/validation/dist/mint-config/schemas/v2/properties/navigation/divisionNav.js").AnchorNavigation<"decorated">[];
14
- } | {
15
- groups: {
16
- group: string;
17
- pages: any[];
18
- icon?: string | {
19
- name: string;
20
- style?: "brands" | "duotone" | "light" | "regular" | "sharp-duotone-solid" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
21
- } | undefined;
22
- hidden?: boolean | undefined;
23
- root?: string | undefined;
24
- }[];
25
- } | {
26
- pages: any[];
27
- }) & {
28
- global?: {
29
- languages?: {
30
- href: string;
31
- language: "en" | "cn" | "es" | "fr" | "jp" | "pt" | "pt-BR" | "de";
32
- default?: boolean | undefined;
33
- hidden?: boolean | undefined;
34
- }[] | undefined;
35
- versions?: {
36
- version: string;
37
- href: string;
38
- default?: boolean | undefined;
39
- hidden?: boolean | undefined;
40
- }[] | undefined;
41
- tabs?: {
42
- href: string;
43
- tab: string;
44
- icon?: string | {
45
- name: string;
46
- style?: "brands" | "duotone" | "light" | "regular" | "sharp-duotone-solid" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
47
- } | undefined;
48
- hidden?: boolean | undefined;
49
- }[] | undefined;
50
- dropdowns?: {
51
- href: string;
52
- dropdown: string;
53
- icon?: string | {
54
- name: string;
55
- style?: "brands" | "duotone" | "light" | "regular" | "sharp-duotone-solid" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
56
- } | undefined;
57
- hidden?: boolean | undefined;
58
- }[] | undefined;
59
- anchors?: {
60
- href: string;
61
- anchor: string;
62
- icon?: string | {
63
- name: string;
64
- style?: "brands" | "duotone" | "light" | "regular" | "sharp-duotone-solid" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
65
- } | undefined;
66
- color?: {
67
- light?: string | undefined;
68
- dark?: string | undefined;
69
- } | undefined;
70
- hidden?: boolean | undefined;
71
- }[] | undefined;
72
- } | undefined;
73
- };
4
+ generatedNav?: DecoratedNavigation;
5
+ generatedDocsNav: DecoratedNavigationConfig;
74
6
  }>;
@@ -34,7 +34,10 @@ export const generateNav = (pagesAcc) => __awaiter(void 0, void 0, void 0, funct
34
34
  getConfigObj(NEXT_PROPS_PATH, 'mint'),
35
35
  getConfigObj(NEXT_PROPS_PATH, 'docs'),
36
36
  ]);
37
- const generatedNav = generateDecoratedMintNavigationFromPages(filenamePageMetadataMap, configObj === null || configObj === void 0 ? void 0 : configObj.navigation);
37
+ let generatedNav;
38
+ if (configObj) {
39
+ generatedNav = generateDecoratedMintNavigationFromPages(filenamePageMetadataMap, configObj.navigation);
40
+ }
38
41
  const generatedDocsNav = generateDecoratedDocsNavigationFromPages(filenamePageMetadataMap, (_a = docsConfigObj === null || docsConfigObj === void 0 ? void 0 : docsConfigObj.navigation) !== null && _a !== void 0 ? _a : upgradeToDocsConfig(configObj).navigation);
39
42
  return { generatedNav, generatedDocsNav };
40
43
  });
@@ -1,7 +1,7 @@
1
1
  import type { DecoratedNavigationPage, MintConfig, OpenApiFile } from '@mintlify/models';
2
2
  import { DocsConfig } from '@mintlify/validation';
3
3
  export declare const getDocsState: () => Promise<{
4
- mintConfig: MintConfig;
4
+ mintConfig?: MintConfig;
5
5
  pagesAcc: Record<string, DecoratedNavigationPage>;
6
6
  openApiFiles: OpenApiFile[];
7
7
  docsConfig: DocsConfig;
@@ -13,20 +13,25 @@ import fse from 'fs-extra';
13
13
  import { join } from 'path';
14
14
  import { CMD_EXEC_PATH, CLIENT_PATH } from '../../constants.js';
15
15
  export const getDocsState = () => __awaiter(void 0, void 0, void 0, function* () {
16
- const mintJsonPath = join(CMD_EXEC_PATH, 'mint.json');
17
- const mintConfig = yield MintConfigUpdater.getConfig(mintJsonPath);
18
- let docsConfig = upgradeToDocsConfig(mintConfig);
19
- const docsJsonPath = join(CMD_EXEC_PATH, 'docs.json');
20
- if (yield fse.pathExists(docsJsonPath)) {
21
- docsConfig = yield DocsConfigUpdater.getConfig(docsJsonPath);
22
- }
23
16
  const { openApiFiles } = yield categorizeFilePaths(CMD_EXEC_PATH);
24
- const { mintConfig: newMintConfig } = yield generateOpenApiAnchorsOrTabs(mintConfig, openApiFiles, CLIENT_PATH);
25
- const { newDocsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = yield generateOpenApiDivisions(docsConfig, openApiFiles, CLIENT_PATH);
26
- return {
27
- mintConfig: newMintConfig,
28
- pagesAcc,
29
- openApiFiles: newOpenApiFiles,
30
- docsConfig: newDocsConfig,
31
- };
17
+ try {
18
+ const mintConfig = yield MintConfigUpdater.getConfig(join(CMD_EXEC_PATH, 'mint.json'));
19
+ const docsConfig = upgradeToDocsConfig(mintConfig);
20
+ const { mintConfig: newMintConfig } = yield generateOpenApiAnchorsOrTabs(mintConfig, openApiFiles, CLIENT_PATH);
21
+ const { newDocsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = yield generateOpenApiDivisions(docsConfig, openApiFiles, CLIENT_PATH);
22
+ return {
23
+ mintConfig: newMintConfig,
24
+ pagesAcc,
25
+ openApiFiles: newOpenApiFiles,
26
+ docsConfig: newDocsConfig,
27
+ };
28
+ }
29
+ catch (_a) {
30
+ const docsJsonPath = join(CMD_EXEC_PATH, 'docs.json');
31
+ if (!(yield fse.pathExists(docsJsonPath)))
32
+ throw new Error('No config found');
33
+ const docsConfig = yield DocsConfigUpdater.getConfig(docsJsonPath);
34
+ const { newDocsConfig, pagesAcc, openApiFiles: newOpenApiFiles, } = yield generateOpenApiDivisions(docsConfig, openApiFiles, CLIENT_PATH);
35
+ return { pagesAcc, openApiFiles: newOpenApiFiles, docsConfig: newDocsConfig };
36
+ }
32
37
  });
@@ -123,10 +123,10 @@ const onUnlinkEvent = (filename) => __awaiter(void 0, void 0, void 0, function*
123
123
  console.log(`Snippet deleted: ${filename}`);
124
124
  break;
125
125
  case 'mintConfig':
126
- console.error('⚠️ mint.json is required, but has been deleted. Exiting.');
127
- process.exit(1);
126
+ console.error('⚠️ mint.json has been deleted.');
128
127
  case 'docsConfig':
129
128
  console.error('⚠️ docs.json has been deleted.');
129
+ break;
130
130
  case 'potentialJsonOpenApiSpec':
131
131
  case 'potentialYamlOpenApiSpec':
132
132
  yield updateOpenApiFiles();
@@ -217,7 +217,9 @@ const onUpdateEvent = (filename, callback) => __awaiter(void 0, void 0, void 0,
217
217
  regenerateNav = true;
218
218
  try {
219
219
  const { mintConfig, openApiFiles, docsConfig } = yield getDocsState();
220
- yield MintConfigUpdater.writeConfigFile(mintConfig, CLIENT_PATH);
220
+ if (mintConfig) {
221
+ yield MintConfigUpdater.writeConfigFile(mintConfig, CLIENT_PATH);
222
+ }
221
223
  yield DocsConfigUpdater.writeConfigFile(docsConfig, CLIENT_PATH);
222
224
  yield updateOpenApiFiles(openApiFiles);
223
225
  }
@@ -16,10 +16,12 @@ import { readJsonFile } from './utils.js';
16
16
  export const updateGeneratedNav = () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  const { pagesAcc } = yield getDocsState();
18
18
  const { generatedNav, generatedDocsNav } = yield generateNav(pagesAcc);
19
- const targetPath = join(NEXT_PROPS_PATH, 'generatedNav.json');
20
- yield fse.outputFile(targetPath, JSON.stringify(generatedNav, null, 2), {
21
- flag: 'w',
22
- });
19
+ if (generatedNav) {
20
+ const targetPath = join(NEXT_PROPS_PATH, 'generatedNav.json');
21
+ yield fse.outputFile(targetPath, JSON.stringify(generatedNav, null, 2), {
22
+ flag: 'w',
23
+ });
24
+ }
23
25
  const targetDocsPath = join(NEXT_PROPS_PATH, 'generatedDocsNav.json');
24
26
  yield fse.outputFile(targetDocsPath, JSON.stringify(generatedDocsNav, null, 2), {
25
27
  flag: 'w',