@docsalot/previewing 0.1.0-beta.0

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.
Files changed (37) hide show
  1. package/README.md +17 -0
  2. package/dist/constants.d.ts +9 -0
  3. package/dist/constants.js +37 -0
  4. package/dist/downloadImage.d.ts +4 -0
  5. package/dist/downloadImage.js +81 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.js +4 -0
  8. package/dist/local-preview/helper-commands/installDepsCommand.d.ts +2 -0
  9. package/dist/local-preview/helper-commands/installDepsCommand.js +11 -0
  10. package/dist/local-preview/index.d.ts +3 -0
  11. package/dist/local-preview/index.js +159 -0
  12. package/dist/local-preview/listener/categorize.d.ts +8 -0
  13. package/dist/local-preview/listener/categorize.js +96 -0
  14. package/dist/local-preview/listener/generate.d.ts +12 -0
  15. package/dist/local-preview/listener/generate.js +73 -0
  16. package/dist/local-preview/listener/index.d.ts +2 -0
  17. package/dist/local-preview/listener/index.js +200 -0
  18. package/dist/local-preview/listener/update.d.ts +2 -0
  19. package/dist/local-preview/listener/update.js +23 -0
  20. package/dist/local-preview/listener/utils/createPage.d.ts +11 -0
  21. package/dist/local-preview/listener/utils/createPage.js +169 -0
  22. package/dist/local-preview/listener/utils/getOpenApiContext.d.ts +21 -0
  23. package/dist/local-preview/listener/utils/getOpenApiContext.js +57 -0
  24. package/dist/local-preview/listener/utils/mintConfigFile.d.ts +2 -0
  25. package/dist/local-preview/listener/utils/mintConfigFile.js +21 -0
  26. package/dist/local-preview/listener/utils/toTitleCase.d.ts +1 -0
  27. package/dist/local-preview/listener/utils/toTitleCase.js +35 -0
  28. package/dist/local-preview/listener/utils/types.d.ts +2 -0
  29. package/dist/local-preview/listener/utils/types.js +1 -0
  30. package/dist/local-preview/listener/utils.d.ts +13 -0
  31. package/dist/local-preview/listener/utils.js +53 -0
  32. package/dist/local-preview/prod.d.ts +3 -0
  33. package/dist/local-preview/prod.js +130 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -0
  35. package/dist/util.d.ts +28 -0
  36. package/dist/util.js +92 -0
  37. package/package.json +81 -0
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @mintlify/previewing
2
+
3
+ Preview Mintlify docs locally.
4
+
5
+ ## 🚀 Installation
6
+
7
+ ```
8
+ npm install @mintlify/previewing
9
+ ```
10
+
11
+ ## Community
12
+
13
+ Join our Discord community if you have questions or just want to chat:
14
+
15
+ [![](https://dcbadge.vercel.app/api/server/ACREKdwjG5)](https://discord.gg/ACREKdwjG5)
16
+
17
+ _Built with 💚 by the Mintlify community._
@@ -0,0 +1,9 @@
1
+ export declare const TARGET_MINT_VERSION = "v0.0.9";
2
+ export declare const INSTALL_PATH: string;
3
+ export declare const HOME_DIR: string;
4
+ export declare const DOT_MINTLIFY: string;
5
+ export declare const VERSION_PATH: string;
6
+ export declare const CLIENT_PATH: string;
7
+ export declare const MINT_PATH: string;
8
+ export declare const CMD_EXEC_PATH: string;
9
+ export declare const SUPPORTED_MEDIA_EXTENSIONS: string[];
@@ -0,0 +1,37 @@
1
+ // ignore for ts
2
+ // @ts-nocheck
3
+ import path from "path";
4
+ import * as url from "url";
5
+ import os from "os";
6
+ // Change this to bump to a newer version of mint's client
7
+ export const TARGET_MINT_VERSION = "v0.0.9";
8
+ // package installation location
9
+ export const INSTALL_PATH = url.fileURLToPath(new URL(".", import.meta.url));
10
+ export const HOME_DIR = os.homedir();
11
+ // DOT_MINTLIFY can be overridden via environment variable
12
+ // Priority: DOCSALOT_PATH env var > hardcoded local path
13
+ // Docker: Set DOCSALOT_PATH=/app/mint-main
14
+ const HARDCODED_PATH = '/Users/faizank/workspace/experiments/live_projects/slashml/mint-main';
15
+ export const DOT_MINTLIFY = process.env.DOCSALOT_PATH || HARDCODED_PATH;
16
+ export const VERSION_PATH = path.join(DOT_MINTLIFY, "mint", "mint-version.txt");
17
+ export const CLIENT_PATH = path.join(DOT_MINTLIFY, "client");
18
+ export const MINT_PATH = path.join(DOT_MINTLIFY, "mint");
19
+ // command execution location
20
+ export const CMD_EXEC_PATH = process.cwd();
21
+ export const SUPPORTED_MEDIA_EXTENSIONS = [
22
+ "jpeg",
23
+ "jpg",
24
+ "jfif",
25
+ "pjpeg",
26
+ "pjp",
27
+ "png",
28
+ "svg",
29
+ "svgz",
30
+ "ico",
31
+ "webp",
32
+ "gif",
33
+ "apng",
34
+ "avif",
35
+ "bmp",
36
+ "mp4",
37
+ ];
@@ -0,0 +1,4 @@
1
+ export declare function isValidImageSrc(src: string): boolean;
2
+ export declare function removeMetadataFromImageSrc(src: string): string;
3
+ export declare function cleanImageSrc(src: string, origin: string): string;
4
+ export default function downloadImage(imageSrc: string, writePath: string, overwrite?: boolean): Promise<void>;
@@ -0,0 +1,81 @@
1
+ import { existsSync, mkdirSync, createWriteStream } from "fs";
2
+ import path from "path";
3
+ import axios from "axios";
4
+ import { getFileExtension } from "./util.js";
5
+ import { SUPPORTED_MEDIA_EXTENSIONS } from "./constants.js";
6
+ async function writeImageToFile(imageSrc, writePath, overwrite) {
7
+ // Avoid unnecessary downloads
8
+ if (existsSync(writePath) && !overwrite) {
9
+ return Promise.reject({
10
+ code: "EEXIST",
11
+ });
12
+ }
13
+ // Create the folders needed if they're missing
14
+ mkdirSync(path.dirname(writePath), { recursive: true });
15
+ const writer = createWriteStream(writePath);
16
+ try {
17
+ const response = await axios.get(imageSrc, {
18
+ responseType: "stream",
19
+ });
20
+ // wx prevents overwriting an image with the exact same name
21
+ // being created in the time we were downloading
22
+ response.data.pipe(writer, {
23
+ flag: "wx",
24
+ });
25
+ return new Promise((resolve, reject) => {
26
+ writer.on("finish", () => resolve(undefined));
27
+ writer.on("error", reject);
28
+ });
29
+ }
30
+ catch (e) {
31
+ return Promise.reject({
32
+ code: "ENOTFOUND",
33
+ });
34
+ }
35
+ }
36
+ export function isValidImageSrc(src) {
37
+ if (!src) {
38
+ return false;
39
+ }
40
+ // We do not support downloading base64 in-line images.
41
+ if (src.startsWith("data:")) {
42
+ return false;
43
+ }
44
+ const imageHref = removeMetadataFromImageSrc(src);
45
+ const ext = getFileExtension(imageHref);
46
+ if (ext && !SUPPORTED_MEDIA_EXTENSIONS.includes(ext)) {
47
+ console.error("🚨 We do not support the file extension: " + ext);
48
+ return false;
49
+ }
50
+ return true;
51
+ }
52
+ export function removeMetadataFromImageSrc(src) {
53
+ // Part of the URL standard
54
+ const metadataSymbols = ["?", "#"];
55
+ metadataSymbols.forEach((dividerSymbol) => {
56
+ // Some frameworks add metadata after the file extension, we need to remove that.
57
+ src = src.split(dividerSymbol)[0];
58
+ });
59
+ return src;
60
+ }
61
+ export function cleanImageSrc(src, origin) {
62
+ // Add origin if the image tags are using relative sources
63
+ return src.startsWith("http") ? src : new URL(src, origin).href;
64
+ }
65
+ export default async function downloadImage(imageSrc, writePath, overwrite = false) {
66
+ await writeImageToFile(imageSrc, writePath, overwrite)
67
+ .then(() => {
68
+ console.log("🖼️ - " + writePath);
69
+ })
70
+ .catch((e) => {
71
+ if (e.code === "EEXIST") {
72
+ console.log(`❌ Skipping existing image ${writePath}`);
73
+ }
74
+ else if (e.code === "ENOTFOUND") {
75
+ console.error(`🚨 Cannot download the image, address not found ${imageSrc}`);
76
+ }
77
+ else {
78
+ console.error(e);
79
+ }
80
+ });
81
+ }
@@ -0,0 +1,4 @@
1
+ import dev from "./local-preview/index.js";
2
+ import prod from "./local-preview/prod.js";
3
+ import installDepsCommand from "./local-preview/helper-commands/installDepsCommand.js";
4
+ export { dev, prod, installDepsCommand };
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import dev from "./local-preview/index.js";
2
+ import prod from "./local-preview/prod.js";
3
+ import installDepsCommand from "./local-preview/helper-commands/installDepsCommand.js";
4
+ export { dev, prod, installDepsCommand };
@@ -0,0 +1,2 @@
1
+ declare const installDeps: () => Promise<void>;
2
+ export default installDeps;
@@ -0,0 +1,11 @@
1
+ import shell from "shelljs";
2
+ import { CLIENT_PATH } from "../../constants.js";
3
+ import { buildLogger, ensureYarn } from "../../util.js";
4
+ const installDeps = async () => {
5
+ const logger = buildLogger("");
6
+ ensureYarn(logger);
7
+ shell.cd(CLIENT_PATH);
8
+ shell.exec("yarn");
9
+ logger.succeed("Dependencies installed.");
10
+ };
11
+ export default installDeps;
@@ -0,0 +1,3 @@
1
+ import { ArgumentsCamelCase } from "yargs";
2
+ declare const dev: (argv: ArgumentsCamelCase) => Promise<void>;
3
+ export default dev;
@@ -0,0 +1,159 @@
1
+ // @ts-nocheck
2
+ import Chalk from "chalk";
3
+ import child_process from "child_process";
4
+ import open from "open";
5
+ import fse, { pathExists } from "fs-extra";
6
+ import inquirer from "inquirer";
7
+ import { isInternetAvailable } from "is-internet-available";
8
+ import path from "path";
9
+ import shell from "shelljs";
10
+ import { Octokit } from "@octokit/rest";
11
+ import { CLIENT_PATH, HOME_DIR, DOT_MINTLIFY, CMD_EXEC_PATH, TARGET_MINT_VERSION, VERSION_PATH, MINT_PATH, } from "../constants.js";
12
+ import { buildLogger, ensureYarn } from "../util.js";
13
+ import listener from "./listener/index.js";
14
+ import { getConfigPath } from "./listener/utils/mintConfigFile.js";
15
+ const nodeModulesExists = async () => {
16
+ // return pathExists(path.join(DOT_MINTLIFY, "mint", "client", "node_modules"));
17
+ return pathExists(path.join(DOT_MINTLIFY, "client", "node_modules"));
18
+ };
19
+ const promptForYarn = async () => {
20
+ const yarnInstalled = shell.which("yarn");
21
+ if (!yarnInstalled) {
22
+ await inquirer
23
+ .prompt([
24
+ {
25
+ type: "confirm",
26
+ name: "confirm",
27
+ message: "yarn must be globally installed. Install yarn?",
28
+ default: true,
29
+ },
30
+ ])
31
+ .then(({ confirm }) => {
32
+ if (confirm) {
33
+ shell.exec("npm install --global yarn");
34
+ }
35
+ else {
36
+ console.log("Installation cancelled.");
37
+ }
38
+ });
39
+ }
40
+ };
41
+ const downloadTargetMint = async (logger) => {
42
+ fse.emptyDirSync(MINT_PATH);
43
+ logger.text = "Downloading Mintlify framework...";
44
+ const octokit = new Octokit();
45
+ const downloadRes = await octokit.repos.downloadTarballArchive({
46
+ owner: "mintlify",
47
+ repo: "mint",
48
+ ref: TARGET_MINT_VERSION,
49
+ });
50
+ logger.text = "Extracting Mintlify framework...";
51
+ const TAR_PATH = path.join(MINT_PATH, "mint.tar.gz");
52
+ fse.writeFileSync(TAR_PATH, Buffer.from(downloadRes.data));
53
+ // strip-components 1 removes the top level directory from the unzipped content
54
+ // which is a folder with the release sha
55
+ fse.mkdirSync(path.join(MINT_PATH, "mint-tmp"));
56
+ shell.exec("tar -xzf mint.tar.gz -C mint-tmp --strip-components 1", {
57
+ silent: true,
58
+ });
59
+ fse.removeSync(TAR_PATH);
60
+ fse.moveSync(path.join(MINT_PATH, "mint-tmp", "client"), path.join(CLIENT_PATH));
61
+ fse.writeFileSync(VERSION_PATH, TARGET_MINT_VERSION);
62
+ // Delete unnecessary content downloaded from GitHub
63
+ fse.removeSync(path.join(MINT_PATH, "mint-tmp"));
64
+ logger.text = "Installing dependencies...";
65
+ ensureYarn(logger);
66
+ shell.cd(CLIENT_PATH);
67
+ shell.exec("yarn", { silent: true });
68
+ };
69
+ const checkForMintJson = async (logger) => {
70
+ const configPath = await getConfigPath(CMD_EXEC_PATH);
71
+ if (configPath == null) {
72
+ logger.fail("Must be ran in a directory where a mint.json file exists.");
73
+ process.exit(1);
74
+ }
75
+ return;
76
+ };
77
+ const dev = async (argv) => {
78
+ buildLogger("DEVS");
79
+ shell.cd(HOME_DIR);
80
+ await promptForYarn();
81
+ const logger = buildLogger("Preparing local Docsalot instance...");
82
+ await fse.ensureDir(MINT_PATH);
83
+ shell.cd(MINT_PATH);
84
+ const internet = await isInternetAvailable();
85
+ if (!internet && !(await pathExists(CLIENT_PATH))) {
86
+ logger.fail("Running mintlify dev for the first time requires an internet connection.");
87
+ process.exit(1);
88
+ }
89
+ // if (internet) {
90
+ // const mintVersionExists = await pathExists(VERSION_PATH);
91
+ // let needToDownloadTargetMint = !mintVersionExists;
92
+ // if (mintVersionExists) {
93
+ // const currVersion = fse.readFileSync(VERSION_PATH, "utf8");
94
+ // if (currVersion !== TARGET_MINT_VERSION) {
95
+ // needToDownloadTargetMint = true;
96
+ // }
97
+ // }
98
+ // if (needToDownloadTargetMint) {
99
+ // await downloadTargetMint(logger);
100
+ // }
101
+ // }
102
+ if (!(await nodeModulesExists())) {
103
+ if (!internet) {
104
+ logger.fail(`Dependencies are missing and you are offline. Connect to the internet and run
105
+
106
+ mintlify install
107
+
108
+ `);
109
+ }
110
+ else {
111
+ logger.fail(`Dependencies were not installed correctly, run
112
+
113
+ mintlify install
114
+
115
+ `);
116
+ }
117
+ process.exit(1);
118
+ }
119
+ await checkForMintJson(logger);
120
+ shell.cd(CLIENT_PATH);
121
+ const relativePath = path.relative(CLIENT_PATH, CMD_EXEC_PATH);
122
+ child_process.spawnSync("yarn preconfigure", [relativePath], { shell: true });
123
+ logger.succeed("Local instance is ready. Launching your site...");
124
+ run(argv.port || "3000");
125
+ };
126
+ const run = (port) => {
127
+ shell.cd(CLIENT_PATH);
128
+ console.log("CLIENT PATH", CLIENT_PATH);
129
+ // For Cloud Run/Docker, use dev-host (binds to 0.0.0.0, no file watching)
130
+ // For local development, use dev-watch (binds to localhost, with file watching)
131
+ const isProduction = process.env.BIND_ALL_INTERFACES === "true";
132
+ const devScript = isProduction ? "npm run dev-host" : "npm run dev-watch";
133
+ const mintlifyDevProcess = child_process.spawn(devScript, {
134
+ env: {
135
+ ...process.env,
136
+ PORT: port,
137
+ },
138
+ cwd: CLIENT_PATH,
139
+ stdio: "pipe",
140
+ shell: true,
141
+ });
142
+ mintlifyDevProcess.stdout.on("data", (data) => {
143
+ const output = data.toString();
144
+ console.log(output);
145
+ if (output.startsWith("> Ready on http://localhost:")) {
146
+ console.log(`🌿 ${Chalk.green(`Your local preview is available at http://localhost:${port}`)}`);
147
+ console.log(`🌿 ${Chalk.green("Press Ctrl+C any time to stop the local preview.")}`);
148
+ open(`http://localhost:${port}`);
149
+ }
150
+ });
151
+ const onExit = () => {
152
+ mintlifyDevProcess.kill("SIGINT");
153
+ process.exit(0);
154
+ };
155
+ process.on("SIGINT", onExit);
156
+ process.on("SIGTERM", onExit);
157
+ listener();
158
+ };
159
+ export default dev;
@@ -0,0 +1,8 @@
1
+ import { PotentialFileCategory } from "./utils/types.js";
2
+ export declare const categorizeFiles: (contentDirectoryPath: string) => Promise<{
3
+ contentFilenames: string[];
4
+ staticFilenames: string[];
5
+ openApiFiles: OpenApiFile[];
6
+ snippets: string[];
7
+ }>;
8
+ export declare const getCategory: (filePath: string) => PotentialFileCategory;
@@ -0,0 +1,96 @@
1
+ // TODO - put in prebuild package
2
+ // @ts-nocheck
3
+ import path from "path";
4
+ import { getFileList } from "@docsalot/prebuild";
5
+ import { getFileExtension, openApiCheck } from "./utils.js";
6
+ export const categorizeFiles = async (contentDirectoryPath) => {
7
+ const allFilesInCmdExecutionPath = getFileList(contentDirectoryPath);
8
+ const contentFilenames = [];
9
+ const staticFilenames = [];
10
+ const promises = [];
11
+ const openApiFiles = [];
12
+ const snippets = [];
13
+ allFilesInCmdExecutionPath.forEach((filename) => {
14
+ promises.push((async () => {
15
+ const extension = getFileExtension(filename);
16
+ let isOpenApi = false;
17
+ if (extension && (extension === "mdx" || extension === "md")) {
18
+ if (filename.startsWith("/_snippets")) {
19
+ snippets.push(filename);
20
+ }
21
+ else {
22
+ contentFilenames.push(filename);
23
+ }
24
+ }
25
+ else if (extension &&
26
+ (extension === "json" || extension === "yaml" || extension === "yml")) {
27
+ const openApiInfo = await openApiCheck(path.join(contentDirectoryPath, filename));
28
+ isOpenApi = openApiInfo.isOpenApi;
29
+ if (isOpenApi) {
30
+ const fileName = path.parse(filename).base;
31
+ openApiFiles.push({
32
+ filename: fileName.substring(0, fileName.lastIndexOf(".")),
33
+ spec: openApiInfo.spec,
34
+ });
35
+ }
36
+ }
37
+ else if (!filename.endsWith("mint.json") && !isOpenApi) {
38
+ // all other files
39
+ staticFilenames.push(filename);
40
+ }
41
+ })());
42
+ });
43
+ await Promise.all(promises);
44
+ return { contentFilenames, staticFilenames, openApiFiles, snippets };
45
+ };
46
+ const excludedMdFiles = ["readme", "license", "contributing", "contribute"];
47
+ const supportedStaticFileExtensions = [
48
+ ".jpeg",
49
+ ".jpg",
50
+ ".jfif",
51
+ ".pjpeg",
52
+ ".pjp",
53
+ ".png",
54
+ ".svg",
55
+ ".svgz",
56
+ ".ico",
57
+ ".webp",
58
+ ".gif",
59
+ ".apng",
60
+ ".avif",
61
+ ".bmp",
62
+ ".mp4",
63
+ ];
64
+ export const getCategory = (filePath) => {
65
+ filePath = filePath.toLowerCase();
66
+ const parsed = path.parse(filePath);
67
+ if (parsed.base === "mint.json" || parsed.base === "layout.json") {
68
+ return "mintConfig";
69
+ }
70
+ const fileName = parsed.name;
71
+ const extension = parsed.ext;
72
+ if (filePath.startsWith("_snippets") &&
73
+ (extension === ".mdx" || extension === ".md")) {
74
+ return "snippet";
75
+ }
76
+ else if (extension === ".mdx") {
77
+ return "page";
78
+ }
79
+ else if (extension === ".md") {
80
+ // Exclude common markdown files people don't want on their docs website
81
+ if (excludedMdFiles.includes(fileName)) {
82
+ throw new Error("Excluded Md File");
83
+ }
84
+ return "page";
85
+ }
86
+ else if (extension === ".yaml" || extension === ".yml") {
87
+ return "potentialYamlOpenApiSpec";
88
+ }
89
+ else if (extension === ".json") {
90
+ return "potentialJsonOpenApiSpec";
91
+ }
92
+ else if (supportedStaticFileExtensions.includes(extension)) {
93
+ return "staticFile";
94
+ }
95
+ throw new Error("Unsupported File Type, No change enacted");
96
+ };
@@ -0,0 +1,12 @@
1
+ type DecoratedMintNavigation = DecoratedMintNavigationEntry[];
2
+ type DecoratedMintNavigationEntry = {
3
+ group: string;
4
+ version?: string;
5
+ pages: DecoratedMintNavigationEntryChild[];
6
+ };
7
+ type DecoratedMintNavigationEntryChild = DecoratedMintNavigationEntry | PageMetadata;
8
+ type PageMetadata = Record<PageMetadataKeys, string>;
9
+ declare const pageMetadataKeys: readonly ["title", "description", "sidebarTitle", "href", "api", "openapi", "contentType", "auth", "version", "mode", "hideFooterPagination", "authors", "lastUpdatedDate", "createdDate", "size"];
10
+ type PageMetadataKeys = typeof pageMetadataKeys[number];
11
+ export declare const generateNav: () => Promise<DecoratedMintNavigation>;
12
+ export {};
@@ -0,0 +1,73 @@
1
+ // TODO - add types
2
+ import { promises as _promises } from "fs";
3
+ import { outputFile } from "fs-extra";
4
+ import path from "path";
5
+ import createPage from "./utils/createPage.js";
6
+ import { categorizeFiles } from "./categorize.js";
7
+ import { CMD_EXEC_PATH } from "../../constants.js";
8
+ import { getConfigObj } from "./utils/mintConfigFile.js";
9
+ const { readFile } = _promises;
10
+ const pageMetadataKeys = [
11
+ "title",
12
+ "description",
13
+ "sidebarTitle",
14
+ "href",
15
+ "api",
16
+ "openapi",
17
+ "contentType",
18
+ "auth",
19
+ "version",
20
+ "mode",
21
+ "hideFooterPagination",
22
+ "authors",
23
+ "lastUpdatedDate",
24
+ "createdDate",
25
+ "size",
26
+ ];
27
+ const generateDecoratedMintNavigationFromPages = (filenamePageMetadataMap, mintConfigNav) => {
28
+ const filenames = Object.keys(filenamePageMetadataMap);
29
+ const createNav = (nav) => {
30
+ return {
31
+ group: nav.group,
32
+ version: nav?.version,
33
+ pages: nav.pages.map((page) => {
34
+ if (typeof page === "string" && filenames.includes(page)) {
35
+ return filenamePageMetadataMap[page];
36
+ }
37
+ return createNav(page);
38
+ }),
39
+ };
40
+ };
41
+ return mintConfigNav.map((nav) => createNav(nav));
42
+ };
43
+ const createFilenamePageMetadataMap = async (contentDirectoryPath, contentFilenames, openApiFiles, clientPath, writeFiles = false) => {
44
+ let pagesAcc = {};
45
+ const contentPromises = [];
46
+ contentFilenames.forEach((filename) => {
47
+ contentPromises.push((async () => {
48
+ const sourcePath = path.join(contentDirectoryPath, filename);
49
+ const contentStr = (await readFile(sourcePath)).toString();
50
+ const { slug, pageMetadata, pageContent } = await createPage(filename, contentStr, contentDirectoryPath, openApiFiles);
51
+ if (clientPath && writeFiles) {
52
+ const targetPath = path.join(clientPath, "src", "_props", filename);
53
+ await outputFile(targetPath, pageContent, {
54
+ flag: "w",
55
+ });
56
+ }
57
+ pagesAcc = {
58
+ ...pagesAcc,
59
+ [slug]: pageMetadata,
60
+ };
61
+ })());
62
+ });
63
+ await Promise.all(contentPromises);
64
+ return pagesAcc;
65
+ };
66
+ export const generateNav = async () => {
67
+ const { contentFilenames, openApiFiles } = await categorizeFiles(CMD_EXEC_PATH);
68
+ const [filenamePageMetadataMap, configObj] = await Promise.all([
69
+ createFilenamePageMetadataMap(CMD_EXEC_PATH, contentFilenames, openApiFiles),
70
+ getConfigObj(CMD_EXEC_PATH),
71
+ ]);
72
+ return generateDecoratedMintNavigationFromPages(filenamePageMetadataMap, configObj?.navigation);
73
+ };
@@ -0,0 +1,2 @@
1
+ declare const listener: () => void;
2
+ export default listener;