mintlify 1.0.6 → 1.0.8
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/README.md +27 -3
- package/bin/browser.js +24 -0
- package/bin/browser.js.map +1 -0
- package/bin/constants.js +8 -0
- package/bin/constants.js.map +1 -0
- package/bin/dev/getOpenApiContext.js +46 -0
- package/bin/dev/getOpenApiContext.js.map +1 -0
- package/bin/dev/index.js +164 -0
- package/bin/dev/index.js.map +1 -0
- package/bin/dev/injectNav.js +97 -0
- package/bin/dev/injectNav.js.map +1 -0
- package/bin/dev/slugToTitle.js +8 -0
- package/bin/dev/slugToTitle.js.map +1 -0
- package/bin/downloadImage.js +27 -0
- package/bin/downloadImage.js.map +1 -0
- package/bin/index.js +49 -106
- package/bin/index.js.map +1 -1
- package/bin/init-command/index.js +51 -0
- package/bin/init-command/index.js.map +1 -0
- package/bin/init-command/templates.js +41 -0
- package/bin/init-command/templates.js.map +1 -0
- package/bin/local-preview/categorizeFiles.js +56 -0
- package/bin/local-preview/categorizeFiles.js.map +1 -0
- package/bin/local-preview/getOpenApiContext.js +46 -0
- package/bin/local-preview/getOpenApiContext.js.map +1 -0
- package/bin/local-preview/index.js +138 -0
- package/bin/local-preview/index.js.map +1 -0
- package/bin/local-preview/injectFavicons.js +72 -0
- package/bin/local-preview/injectFavicons.js.map +1 -0
- package/bin/local-preview/listener.js +112 -0
- package/bin/local-preview/listener.js.map +1 -0
- package/bin/local-preview/metadata.js +121 -0
- package/bin/local-preview/metadata.js.map +1 -0
- package/bin/local-preview/mintConfigFile.js +43 -0
- package/bin/local-preview/mintConfigFile.js.map +1 -0
- package/bin/local-preview/openApiCheck.js +16 -0
- package/bin/local-preview/openApiCheck.js.map +1 -0
- package/bin/local-preview/slugToTitle.js +8 -0
- package/bin/local-preview/slugToTitle.js.map +1 -0
- package/bin/mint/client/.babel-plugin-macrosrc.json +5 -0
- package/bin/mint/client/.babelrc +4 -0
- package/bin/mint/client/.editorconfig +12 -0
- package/bin/mint/client/.eslintrc.json +7 -0
- package/bin/mint/client/.prettierignore +4 -0
- package/bin/mint/client/.prettierrc +14 -0
- package/bin/mint/client/.vscode/launch.json +28 -0
- package/bin/mint/client/README.md +46 -0
- package/bin/mint/client/jest.config.ts +195 -0
- package/bin/mint/client/next-env.d.ts +4 -0
- package/bin/mint/client/next.config.js +152 -0
- package/bin/mint/client/package.json +140 -0
- package/bin/mint/client/postcss.config.cjs +9 -0
- package/bin/mint/client/prebuild/faviconConfig.js +35 -0
- package/bin/mint/client/prebuild/getOpenApiContext.js +53 -0
- package/bin/mint/client/prebuild/index.js +117 -0
- package/bin/mint/client/prebuild/injectNav.js +115 -0
- package/bin/mint/client/prebuild/slugToTitle.js +7 -0
- package/bin/mint/client/rehype/withApiComponents.js +60 -0
- package/bin/mint/client/rehype/withCodeBlocks.js +54 -0
- package/bin/mint/client/rehype/withLayouts.js +113 -0
- package/bin/mint/client/rehype/withLinkRoles.js +13 -0
- package/bin/mint/client/rehype/withRawComponents.js +13 -0
- package/bin/mint/client/rehype/withStaticProps.js +25 -0
- package/bin/mint/client/rehype/withSyntaxHighlighting.js +60 -0
- package/bin/mint/client/remark/utils.js +369 -0
- package/bin/mint/client/remark/withFrames.js +55 -0
- package/bin/mint/client/remark/withImportsInjected.js +36 -0
- package/bin/mint/client/remark/withNextLinks.js +37 -0
- package/bin/mint/client/remark/withTableOfContents.js +71 -0
- package/bin/mint/client/scripts/local-to-docs.js +72 -0
- package/bin/mint/client/scripts/local.js +177 -0
- package/bin/mint/client/sentry.client.config.js +15 -0
- package/bin/mint/client/sentry.properties +4 -0
- package/bin/mint/client/sentry.server.config.js +15 -0
- package/bin/mint/client/src/analytics/AbstractAnalyticsImplementation.ts +50 -0
- package/bin/mint/client/src/analytics/AnalyticsContext.ts +5 -0
- package/bin/mint/client/src/analytics/AnalyticsMediator.ts +101 -0
- package/bin/mint/client/src/analytics/FakeAnalyticsMediator.ts +9 -0
- package/bin/mint/client/src/analytics/GA4Script.tsx +33 -0
- package/bin/mint/client/src/analytics/implementations/amplitude.ts +26 -0
- package/bin/mint/client/src/analytics/implementations/fathom.ts +38 -0
- package/bin/mint/client/src/analytics/implementations/ga4.ts +33 -0
- package/bin/mint/client/src/analytics/implementations/hotjar.ts +53 -0
- package/bin/mint/client/src/analytics/implementations/mixpanel-browser.d.ts +1 -0
- package/bin/mint/client/src/analytics/implementations/mixpanel.ts +52 -0
- package/bin/mint/client/src/analytics/implementations/posthog.ts +37 -0
- package/bin/mint/client/src/components/Accordion/Accordion.tsx +43 -0
- package/bin/mint/client/src/components/Accordion/index.ts +4 -0
- package/bin/mint/client/src/components/ApiExample.tsx +9 -0
- package/bin/mint/client/src/components/Card.tsx +51 -0
- package/bin/mint/client/src/components/CodeGroup.tsx +132 -0
- package/bin/mint/client/src/components/Editor.tsx +12 -0
- package/bin/mint/client/src/components/Expandable.tsx +40 -0
- package/bin/mint/client/src/components/Heading.tsx +84 -0
- package/bin/mint/client/src/components/Param.tsx +56 -0
- package/bin/mint/client/src/components/Request.tsx +19 -0
- package/bin/mint/client/src/components/ResponseField.tsx +33 -0
- package/bin/mint/client/src/components/TabBar.tsx +61 -0
- package/bin/mint/client/src/config.ts +115 -0
- package/bin/mint/client/src/css/bar-of-progress.css +10 -0
- package/bin/mint/client/src/css/base.css +29 -0
- package/bin/mint/client/src/css/font-awesome.css +7 -0
- package/bin/mint/client/src/css/fonts.css +44 -0
- package/bin/mint/client/src/css/main.css +11 -0
- package/bin/mint/client/src/css/prism.css +270 -0
- package/bin/mint/client/src/css/utilities.css +43 -0
- package/bin/mint/client/src/enums/components.ts +8 -0
- package/bin/mint/client/src/fonts/FiraCode-VF.woff +0 -0
- package/bin/mint/client/src/fonts/FiraCode-VF.woff2 +0 -0
- package/bin/mint/client/src/fonts/IBMPlexMono-Regular.ttf +0 -0
- package/bin/mint/client/src/fonts/IBMPlexMono-SemiBold.ttf +0 -0
- package/bin/mint/client/src/fonts/Inter-italic-latin.var.woff2 +0 -0
- package/bin/mint/client/src/fonts/Inter-roman-latin.var.woff2 +0 -0
- package/bin/mint/client/src/fonts/Pally-Variable.ttf +0 -0
- package/bin/mint/client/src/fonts/SourceSansPro-Regular.otf +0 -0
- package/bin/mint/client/src/fonts/SourceSerifPro-Regular.ttf +0 -0
- package/bin/mint/client/src/fonts/Synonym-Variable.ttf +0 -0
- package/bin/mint/client/src/fonts/Ubuntu-Mono-bold.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular.module.css +11 -0
- package/bin/mint/client/src/hooks/useActionKey.ts +20 -0
- package/bin/mint/client/src/hooks/useIsomorphicLayoutEffect.ts +3 -0
- package/bin/mint/client/src/hooks/useMedia.ts +27 -0
- package/bin/mint/client/src/hooks/usePrevNext.ts +34 -0
- package/bin/mint/client/src/hooks/useTop.ts +15 -0
- package/bin/mint/client/src/icons/CopyToClipboard.tsx +33 -0
- package/bin/mint/client/src/index.d.ts +1 -0
- package/bin/mint/client/src/layouts/ApiSupplemental.tsx +173 -0
- package/bin/mint/client/src/layouts/ContentsLayout.tsx +256 -0
- package/bin/mint/client/src/layouts/DocumentationLayout.tsx +44 -0
- package/bin/mint/client/src/layouts/OpenApiContent.tsx +301 -0
- package/bin/mint/client/src/layouts/SidebarLayout.tsx +412 -0
- package/bin/mint/client/src/layouts/UserFeedback.tsx +73 -0
- package/bin/mint/client/src/layouts/getGroupsInDivision.ts +25 -0
- package/bin/mint/client/src/layouts/isPathInGroupPages.ts +10 -0
- package/bin/mint/client/src/metadata.ts +58 -0
- package/bin/mint/client/src/openapi.ts +3 -0
- package/bin/mint/client/src/pages/404.tsx +73 -0
- package/bin/mint/client/src/pages/_app.tsx +138 -0
- package/bin/mint/client/src/pages/_document.tsx +57 -0
- package/bin/mint/client/src/pages/api/issue.ts +10 -0
- package/bin/mint/client/src/pages/api/name.ts +8 -0
- package/bin/mint/client/src/pages/api/request.ts +31 -0
- package/bin/mint/client/src/pages/api/suggest.ts +10 -0
- package/bin/mint/client/src/pages/api/syntax-highlighted-json.ts +13 -0
- package/bin/mint/client/src/pages/api/utils.ts +6 -0
- package/bin/mint/client/src/pages/index.tsx +31 -0
- package/bin/mint/client/src/ui/Api.tsx +359 -0
- package/bin/mint/client/src/ui/Footer.tsx +124 -0
- package/bin/mint/client/src/ui/Header.tsx +370 -0
- package/bin/mint/client/src/ui/Logo.tsx +55 -0
- package/bin/mint/client/src/ui/PageHeader.tsx +51 -0
- package/bin/mint/client/src/ui/Search.tsx +386 -0
- package/bin/mint/client/src/ui/ThemeToggle.tsx +285 -0
- package/bin/mint/client/src/ui/Title.tsx +22 -0
- package/bin/mint/client/src/ui/TopLevelLink.tsx +122 -0
- package/bin/mint/client/src/utils/api.ts +252 -0
- package/bin/mint/client/src/utils/brands.ts +217 -0
- package/bin/mint/client/src/utils/castArray.ts +3 -0
- package/bin/mint/client/src/utils/childrenArray.ts +3 -0
- package/bin/mint/client/src/utils/fit.ts +27 -0
- package/bin/mint/client/src/utils/fontAwesome.ts +577 -0
- package/bin/mint/client/src/utils/getAnalyticsConfig.ts +14 -0
- package/bin/mint/client/src/utils/getLogoHref.ts +9 -0
- package/bin/mint/client/src/utils/getOpenApiContext.ts +26 -0
- package/bin/mint/client/src/utils/importAll.ts +6 -0
- package/bin/mint/client/src/utils/isObject.ts +3 -0
- package/bin/mint/client/src/utils/kebabToTitleCase.ts +3 -0
- package/bin/mint/client/src/utils/loadImage.ts +8 -0
- package/bin/mint/client/src/utils/slugToTitle.ts +7 -0
- package/bin/mint/client/src/utils/wait.ts +5 -0
- package/bin/mint/client/tailwind.config.cjs +323 -0
- package/bin/mint/client/test/test.test.ts +5 -0
- package/bin/mint/client/tsconfig.json +36 -0
- package/bin/mint/client/yarn.lock +9702 -0
- package/bin/navigation.js +4 -0
- package/bin/navigation.js.map +1 -0
- package/bin/pageTemplate.js +30 -0
- package/bin/pageTemplate.js.map +1 -0
- package/bin/scraping/combineNavWithEmptyGroupTitles.js +20 -0
- package/bin/scraping/combineNavWithEmptyGroupTitles.js.map +1 -0
- package/bin/scraping/detectFramework.js +25 -0
- package/bin/scraping/detectFramework.js.map +1 -0
- package/bin/scraping/downloadAllImages.js +57 -0
- package/bin/scraping/downloadAllImages.js.map +1 -0
- package/bin/scraping/getSitemapLinks.js +18 -0
- package/bin/scraping/getSitemapLinks.js.map +1 -0
- package/bin/scraping/replaceImagePaths.js +17 -0
- package/bin/scraping/replaceImagePaths.js.map +1 -0
- package/bin/scraping/scrapeFileGettingFileNameFromUrl.js +43 -0
- package/bin/scraping/scrapeFileGettingFileNameFromUrl.js.map +1 -0
- package/bin/scraping/scrapeGettingFileNameFromUrl.js +14 -0
- package/bin/scraping/scrapeGettingFileNameFromUrl.js.map +1 -0
- package/bin/scraping/scrapePage.js +9 -0
- package/bin/scraping/scrapePage.js.map +1 -0
- package/bin/scraping/scrapePageCommands.js +48 -0
- package/bin/scraping/scrapePageCommands.js.map +1 -0
- package/bin/scraping/scrapeSection.js +9 -0
- package/bin/scraping/scrapeSection.js.map +1 -0
- package/bin/scraping/scrapeSectionCommands.js +90 -0
- package/bin/scraping/scrapeSectionCommands.js.map +1 -0
- package/bin/scraping/site-scrapers/getLinksRecursively.js +33 -0
- package/bin/scraping/site-scrapers/getLinksRecursively.js.map +1 -0
- package/bin/scraping/site-scrapers/scrapeDocusaurusPage.js +43 -0
- package/bin/scraping/site-scrapers/scrapeDocusaurusPage.js.map +1 -0
- package/bin/scraping/site-scrapers/scrapeDocusaurusSection.js +52 -0
- package/bin/scraping/site-scrapers/scrapeDocusaurusSection.js.map +1 -0
- package/bin/{scrapeGitBookPage.js → scraping/site-scrapers/scrapeGitBookPage.js} +10 -5
- package/bin/scraping/site-scrapers/scrapeGitBookPage.js.map +1 -0
- package/bin/scraping/site-scrapers/scrapeGitBookSection.js +51 -0
- package/bin/scraping/site-scrapers/scrapeGitBookSection.js.map +1 -0
- package/bin/scraping/site-scrapers/scrapeReadMePage.js +35 -0
- package/bin/scraping/site-scrapers/scrapeReadMePage.js.map +1 -0
- package/bin/scraping/site-scrapers/scrapeReadMeSection.js +38 -0
- package/bin/scraping/site-scrapers/scrapeReadMeSection.js.map +1 -0
- package/bin/util.js +47 -8
- package/bin/util.js.map +1 -1
- package/bin/validation/isValidLink.js +11 -0
- package/bin/validation/isValidLink.js.map +1 -0
- package/bin/validation/stopIfInvalidLink.js +9 -0
- package/bin/validation/stopIfInvalidLink.js.map +1 -0
- package/package.json +21 -4
- package/src/browser.ts +24 -0
- package/src/constants.ts +10 -0
- package/src/downloadImage.ts +35 -0
- package/src/index.ts +111 -122
- package/src/init-command/index.ts +59 -0
- package/src/{templates.ts → init-command/templates.ts} +0 -0
- package/src/local-preview/categorizeFiles.ts +74 -0
- package/src/local-preview/getOpenApiContext.ts +61 -0
- package/src/local-preview/index.ts +164 -0
- package/src/local-preview/injectFavicons.ts +76 -0
- package/src/local-preview/listener.ts +116 -0
- package/src/local-preview/metadata.ts +154 -0
- package/src/local-preview/mintConfigFile.ts +48 -0
- package/src/local-preview/openApiCheck.ts +19 -0
- package/src/local-preview/slugToTitle.ts +7 -0
- package/src/navigation.ts +12 -0
- package/src/pageTemplate.ts +32 -0
- package/src/scraping/combineNavWithEmptyGroupTitles.ts +21 -0
- package/src/scraping/detectFramework.ts +31 -0
- package/src/scraping/downloadAllImages.ts +79 -0
- package/src/scraping/getSitemapLinks.ts +18 -0
- package/src/scraping/replaceImagePaths.ts +21 -0
- package/src/scraping/scrapeFileGettingFileNameFromUrl.ts +81 -0
- package/src/scraping/scrapeGettingFileNameFromUrl.ts +50 -0
- package/src/scraping/scrapePage.ts +24 -0
- package/src/scraping/scrapePageCommands.ts +52 -0
- package/src/scraping/scrapeSection.ts +16 -0
- package/src/scraping/scrapeSectionCommands.ts +110 -0
- package/src/scraping/site-scrapers/getLinksRecursively.ts +40 -0
- package/src/scraping/site-scrapers/scrapeDocusaurusPage.ts +67 -0
- package/src/scraping/site-scrapers/scrapeDocusaurusSection.ts +80 -0
- package/src/{scrapeGitBookPage.ts → scraping/site-scrapers/scrapeGitBookPage.ts} +25 -5
- package/src/scraping/site-scrapers/scrapeGitBookSection.ts +77 -0
- package/src/scraping/site-scrapers/scrapeReadMePage.ts +57 -0
- package/src/scraping/site-scrapers/scrapeReadMeSection.ts +60 -0
- package/src/util.ts +53 -7
- package/src/validation/isValidLink.ts +9 -0
- package/src/validation/stopIfInvalidLink.ts +9 -0
- package/tsconfig.json +1 -1
- package/bin/scrapeGitBook.js +0 -28
- package/bin/scrapeGitBook.js.map +0 -1
- package/bin/scrapeGitBookPage.js.map +0 -1
- package/bin/scrapeReadMe.js +0 -60
- package/bin/scrapeReadMe.js.map +0 -1
- package/bin/scrapeReadMePage.js +0 -28
- package/bin/scrapeReadMePage.js.map +0 -1
- package/src/scrapeReadMe.ts +0 -79
- package/src/scrapeReadMePage.ts +0 -37
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// TODO - add types
|
|
2
|
+
import fse from "fs-extra";
|
|
3
|
+
import { promises as _promises } from "fs";
|
|
4
|
+
import matter from "gray-matter";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import categorizeFiles from "./categorizeFiles.js";
|
|
7
|
+
import { getConfigObj } from "./mintConfigFile.js";
|
|
8
|
+
import { getOpenApiTitleAndDescription } from "./getOpenApiContext.js";
|
|
9
|
+
import { slugToTitle } from "./slugToTitle.js";
|
|
10
|
+
import { CLIENT_PATH, CMD_EXEC_PATH } from "../constants.js";
|
|
11
|
+
const { readFile } = _promises;
|
|
12
|
+
// End matter is front matter, but at the end
|
|
13
|
+
const getIndexOfEndMatter = (fileContents) => {
|
|
14
|
+
const frontMatters = fileContents.match(/---\n(title:.+\n|description:.+\n|sidebarTitle:.+\n|api:.+\n|openapi:.+\n)+---$/m);
|
|
15
|
+
if (frontMatters) {
|
|
16
|
+
return fileContents.indexOf(frontMatters[0]);
|
|
17
|
+
}
|
|
18
|
+
return -1;
|
|
19
|
+
};
|
|
20
|
+
export const potentiallyRemoveEndMatter = (fileContents) => {
|
|
21
|
+
const endMatterIndex = getIndexOfEndMatter(fileContents);
|
|
22
|
+
if (endMatterIndex === -1) {
|
|
23
|
+
return fileContents;
|
|
24
|
+
}
|
|
25
|
+
return fileContents.substring(0, endMatterIndex);
|
|
26
|
+
};
|
|
27
|
+
const getMetadata = (fileContents) => {
|
|
28
|
+
const { data } = matter(fileContents);
|
|
29
|
+
if (Object.keys(data).length > 0) {
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
const startIndex = getIndexOfEndMatter(fileContents);
|
|
33
|
+
if (startIndex === -1) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
const fileContentFromFrontMatter = fileContents.substring(startIndex);
|
|
37
|
+
const { data: nonTopFrontMatter } = matter(fileContentFromFrontMatter);
|
|
38
|
+
return nonTopFrontMatter;
|
|
39
|
+
};
|
|
40
|
+
export const createPage = (path, content, openApiObj) => {
|
|
41
|
+
const slug = path.replace(/\.mdx?$/, "").substring(1);
|
|
42
|
+
let defaultTitle = slugToTitle(slug);
|
|
43
|
+
const metadata = getMetadata(content);
|
|
44
|
+
// Append data from OpenAPI if it exists
|
|
45
|
+
const { title, description } = getOpenApiTitleAndDescription(openApiObj, metadata === null || metadata === void 0 ? void 0 : metadata.openapi);
|
|
46
|
+
if (title) {
|
|
47
|
+
defaultTitle = title;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
[slug]: Object.assign(Object.assign({ title: defaultTitle, description }, metadata), { href: `/${slug}` }),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export const createMetadataFileFromPages = (pages, configObj) => {
|
|
54
|
+
const targetPath = path.join(CLIENT_PATH, "src", "metadata.json");
|
|
55
|
+
const createNav = (nav) => {
|
|
56
|
+
return {
|
|
57
|
+
group: nav.group,
|
|
58
|
+
pages: nav.pages.map((page) => {
|
|
59
|
+
if (typeof page === "string") {
|
|
60
|
+
return pages[page];
|
|
61
|
+
}
|
|
62
|
+
return createNav(page);
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
if ((configObj === null || configObj === void 0 ? void 0 : configObj.navigation) == null) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
let navFile = configObj.navigation.map((nav) => createNav(nav));
|
|
70
|
+
const filterOutNullInPages = (pages) => {
|
|
71
|
+
const newPages = [];
|
|
72
|
+
pages.forEach((page) => {
|
|
73
|
+
if (page == null) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (page === null || page === void 0 ? void 0 : page.pages) {
|
|
77
|
+
const newGroup = filterOutNullInGroup(page);
|
|
78
|
+
newPages.push(newGroup);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
newPages.push(page);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return newPages;
|
|
85
|
+
};
|
|
86
|
+
const filterOutNullInGroup = (group) => {
|
|
87
|
+
const newPages = filterOutNullInPages(group.pages);
|
|
88
|
+
const newGroup = Object.assign(Object.assign({}, group), { pages: newPages });
|
|
89
|
+
return newGroup;
|
|
90
|
+
};
|
|
91
|
+
const newNavFile = navFile.map((group) => {
|
|
92
|
+
return filterOutNullInGroup(group);
|
|
93
|
+
});
|
|
94
|
+
fse.outputFileSync(targetPath, JSON.stringify(newNavFile, null, 2), {
|
|
95
|
+
flag: "w",
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
export const createMetadataFile = async () => {
|
|
99
|
+
// create pages
|
|
100
|
+
const { markdownFiles, openApiBuffer } = await categorizeFiles();
|
|
101
|
+
let openApiObj = null;
|
|
102
|
+
if (openApiBuffer) {
|
|
103
|
+
openApiObj = JSON.parse(openApiBuffer.toString());
|
|
104
|
+
}
|
|
105
|
+
// create config object
|
|
106
|
+
const configObj = await getConfigObj();
|
|
107
|
+
let pages = {};
|
|
108
|
+
const mdPromises = [];
|
|
109
|
+
markdownFiles.forEach((filename) => {
|
|
110
|
+
mdPromises.push((async () => {
|
|
111
|
+
const sourcePath = path.join(CMD_EXEC_PATH, filename);
|
|
112
|
+
const fileContent = await readFile(sourcePath);
|
|
113
|
+
const contentStr = fileContent.toString();
|
|
114
|
+
const page = createPage(filename, contentStr, openApiObj);
|
|
115
|
+
pages = Object.assign(Object.assign({}, pages), page);
|
|
116
|
+
})());
|
|
117
|
+
});
|
|
118
|
+
await Promise.all(mdPromises);
|
|
119
|
+
createMetadataFileFromPages(pages, configObj);
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|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AC;YAC1D,KAAK,mCACA,KAAK,GACL,IAAI,CACR,CAAC;QACJ,CAAC,CAAC,EAAE,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC9B,2BAA2B,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { promises as _promises } from "fs";
|
|
2
|
+
import fse, { pathExists } from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { CLIENT_PATH, CMD_EXEC_PATH } from "../constants.js";
|
|
5
|
+
const { readFile } = _promises;
|
|
6
|
+
const getConfigPath = async () => {
|
|
7
|
+
let configPath = null;
|
|
8
|
+
if (await pathExists(path.join(CMD_EXEC_PATH, "mint.config.json"))) {
|
|
9
|
+
configPath = path.join(CMD_EXEC_PATH, "mint.config.json");
|
|
10
|
+
}
|
|
11
|
+
if (await pathExists(path.join(CMD_EXEC_PATH, "mint.json"))) {
|
|
12
|
+
configPath = path.join(CMD_EXEC_PATH, "mint.json");
|
|
13
|
+
}
|
|
14
|
+
return configPath;
|
|
15
|
+
};
|
|
16
|
+
export const getConfigObj = async () => {
|
|
17
|
+
const configPath = await getConfigPath();
|
|
18
|
+
let configObj = null;
|
|
19
|
+
if (configPath) {
|
|
20
|
+
const configContents = await readFile(configPath);
|
|
21
|
+
configObj = JSON.parse(configContents.toString());
|
|
22
|
+
}
|
|
23
|
+
return configObj;
|
|
24
|
+
};
|
|
25
|
+
export const updateConfigFile = async (logger) => {
|
|
26
|
+
const configTargetPath = path.join(CLIENT_PATH, "src", "mint.json");
|
|
27
|
+
await fse.remove(configTargetPath);
|
|
28
|
+
let configObj = null;
|
|
29
|
+
const configPath = await getConfigPath();
|
|
30
|
+
if (configPath) {
|
|
31
|
+
await fse.remove(configTargetPath);
|
|
32
|
+
await fse.copy(configPath, configTargetPath);
|
|
33
|
+
logger.succeed("mint config file synced");
|
|
34
|
+
const configContents = await readFile(configPath);
|
|
35
|
+
configObj = JSON.parse(configContents.toString());
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
logger.fail("Must be ran in a directory where a mint.json file exists.");
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
return configObj;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=mintConfigFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mintConfigFile.js","sourceRoot":"","sources":["../../src/local-preview/mintConfigFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,GAAG,EAAE,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;AAE/B,MAAM,aAAa,GAAG,KAAK,IAA4B,EAAE;IACvD,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,EAAE;QAClE,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;KAC3D;IAED,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,EAAE;QAC3D,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;KACpD;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,IAA4B,EAAE;IAC7D,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;IACzC,IAAI,SAAS,GAAG,IAAI,CAAC;IACrB,IAAI,UAAU,EAAE;QACd,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC;QAClD,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;KACnD;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAW,EAAE,EAAE;IACpD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACpE,MAAM,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACnC,IAAI,SAAS,GAAG,IAAI,CAAC;IACrB,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;IAEzC,IAAI,UAAU,EAAE;QACd,MAAM,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACnC,MAAM,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAC1C,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC;QAClD,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;KACnD;SAAM;QACL,MAAM,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
2
|
+
const openApiCheck = async (path) => {
|
|
3
|
+
let buffer = undefined;
|
|
4
|
+
let isOpenApi = false;
|
|
5
|
+
try {
|
|
6
|
+
const api = await SwaggerParser.validate(path);
|
|
7
|
+
buffer = Buffer.from(JSON.stringify(api, null, 2), "utf-8");
|
|
8
|
+
isOpenApi = true;
|
|
9
|
+
}
|
|
10
|
+
catch (_a) {
|
|
11
|
+
// not valid openApi
|
|
12
|
+
}
|
|
13
|
+
return { buffer, isOpenApi };
|
|
14
|
+
};
|
|
15
|
+
export default openApiCheck;
|
|
16
|
+
//# sourceMappingURL=openApiCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openApiCheck.js","sourceRoot":"","sources":["../../src/local-preview/openApiCheck.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAGxD,MAAM,YAAY,GAAG,KAAK,EACxB,IAAY,EACiD,EAAE;IAC/D,IAAI,MAAM,GAAG,SAAS,CAAC;IACvB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI;QACF,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC5D,SAAS,GAAG,IAAI,CAAC;KAClB;IAAC,WAAM;QACN,oBAAoB;KACrB;IACD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const slugToTitle = (slug) => {
|
|
2
|
+
const slugArr = slug.split("/");
|
|
3
|
+
let defaultTitle = slugArr[slugArr.length - 1].split("-").join(" "); //replace all dashes
|
|
4
|
+
defaultTitle = defaultTitle.split("_").join(" "); //replace all underscores
|
|
5
|
+
defaultTitle = defaultTitle.charAt(0).toUpperCase() + defaultTitle.slice(1); //capitalize first letter
|
|
6
|
+
return defaultTitle;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=slugToTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugToTitle.js","sourceRoot":"","sources":["../../src/local-preview/slugToTitle.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,EAAE;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,oBAAoB;IACzF,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,yBAAyB;IAC3E,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB;IACtG,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": true,
|
|
3
|
+
"printWidth": 100,
|
|
4
|
+
"trailingComma": "es5",
|
|
5
|
+
"arrowParens": "always",
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"quoteProps": "as-needed",
|
|
9
|
+
"jsxSingleQuote": false,
|
|
10
|
+
"bracketSpacing": true,
|
|
11
|
+
"bracketSameLine": false,
|
|
12
|
+
"importOrder": ["<THIRD_PARTY_MODULES>", "^@/(.*)$", "^[./]"],
|
|
13
|
+
"importOrderSeparation": true
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Next.js: debug server-side",
|
|
6
|
+
"type": "node-terminal",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"command": "yarn dev"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Next.js: debug client-side",
|
|
12
|
+
"type": "chrome",
|
|
13
|
+
"request": "launch",
|
|
14
|
+
"url": "http://localhost:3000"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "Next.js: debug full stack",
|
|
18
|
+
"type": "node-terminal",
|
|
19
|
+
"request": "launch",
|
|
20
|
+
"command": "yarn dev",
|
|
21
|
+
"serverReadyAction": {
|
|
22
|
+
"pattern": "started server on .+, url: (https?://.+)",
|
|
23
|
+
"uriFormat": "%s",
|
|
24
|
+
"action": "debugWithChrome"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Mintlify Client
|
|
2
|
+
|
|
3
|
+
The client is essentially a frontend template used to host documentation. In production, when `yarn prebuild` is ran it fetches all the relevant assets (the config file, the content (mdx files), and static assets) and plugs them into the appropriate locations before building.
|
|
4
|
+
|
|
5
|
+
## Your First Code Contribution
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Node v16.13.2 (npm v8.1.2)
|
|
10
|
+
- Yarn
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
From a terminal, where you have cloned the repository, execute the following command to install the required dependencies:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
yarn
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Build
|
|
21
|
+
|
|
22
|
+
- `INTERNAL_SITE_BEARER_TOKEN=example yarn prebuild` - fetches the files for the site associated with that bearer token from GitHub. You need the pre-hashed bearer token for that to work. Mintlify employees can request the token that grants access to a test site. In the future, we will work on a way of generating temporary bearer tokens from an employee login.
|
|
23
|
+
- `yarn local` - the local version of `yarn prebuild` (fetches the content from the local `../docs` folder)
|
|
24
|
+
- `yarn local-to-docs` - transfers the untracked files to the `../docs` file (helpful for when you're working on content and you want to see changes live)
|
|
25
|
+
- Both `yarn local` and `yarn local-to-docs` take in a filepath as a parameter for when you want to transfer files to a directory that isn't `../docs`. For example, let's say I'm working on a migration for a client, then I can run `yarn local ../../clients/vital/docs` to get the files from that folder.
|
|
26
|
+
|
|
27
|
+
### Watch
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
yarn dev
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Formatting
|
|
34
|
+
|
|
35
|
+
This project uses [prettier](https://prettier.io/) for code formatting. You can run prettier across the code by calling `yarn run format` from a terminal.
|
|
36
|
+
|
|
37
|
+
To format the code as you make changes you can install the [Prettier - Code formatter](https://marketplace.visualstudio.com/items/esbenp.prettier-vscode) extension.
|
|
38
|
+
|
|
39
|
+
Add the following to your User Settings to run prettier:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
"editor.formatOnSave": true,
|
|
43
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can either modify the `settings.json` file or click on Preferences > Settings to use the UI.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
3
|
+
* https://jestjs.io/docs/configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
// All imported modules in your tests should be mocked automatically
|
|
8
|
+
// automock: false,
|
|
9
|
+
|
|
10
|
+
// Stop running tests after `n` failures
|
|
11
|
+
// bail: 0,
|
|
12
|
+
|
|
13
|
+
// The directory where Jest should store its cached dependency information
|
|
14
|
+
// cacheDirectory: "/private/var/folders/k_/_vv6d9192pq13p60l40ts3440000gn/T/jest_dx",
|
|
15
|
+
|
|
16
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
|
17
|
+
// clearMocks: false,
|
|
18
|
+
|
|
19
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
+
// collectCoverage: false,
|
|
21
|
+
|
|
22
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
+
// collectCoverageFrom: undefined,
|
|
24
|
+
|
|
25
|
+
// The directory where Jest should output its coverage files
|
|
26
|
+
// coverageDirectory: undefined,
|
|
27
|
+
|
|
28
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
+
// coveragePathIgnorePatterns: [
|
|
30
|
+
// "/node_modules/"
|
|
31
|
+
// ],
|
|
32
|
+
|
|
33
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
+
coverageProvider: "v8",
|
|
35
|
+
|
|
36
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
+
// coverageReporters: [
|
|
38
|
+
// "json",
|
|
39
|
+
// "text",
|
|
40
|
+
// "lcov",
|
|
41
|
+
// "clover"
|
|
42
|
+
// ],
|
|
43
|
+
|
|
44
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
+
// coverageThreshold: undefined,
|
|
46
|
+
|
|
47
|
+
// A path to a custom dependency extractor
|
|
48
|
+
// dependencyExtractor: undefined,
|
|
49
|
+
|
|
50
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
+
// errorOnDeprecated: false,
|
|
52
|
+
|
|
53
|
+
// The default configuration for fake timers
|
|
54
|
+
// fakeTimers: {
|
|
55
|
+
// "enableGlobally": false
|
|
56
|
+
// },
|
|
57
|
+
|
|
58
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
59
|
+
// forceCoverageMatch: [],
|
|
60
|
+
|
|
61
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
62
|
+
// globalSetup: undefined,
|
|
63
|
+
|
|
64
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
65
|
+
// globalTeardown: undefined,
|
|
66
|
+
|
|
67
|
+
// A set of global variables that need to be available in all test environments
|
|
68
|
+
// globals: {},
|
|
69
|
+
|
|
70
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
71
|
+
// maxWorkers: "50%",
|
|
72
|
+
|
|
73
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
74
|
+
// moduleDirectories: [
|
|
75
|
+
// "node_modules"
|
|
76
|
+
// ],
|
|
77
|
+
|
|
78
|
+
// An array of file extensions your modules use
|
|
79
|
+
// moduleFileExtensions: [
|
|
80
|
+
// "js",
|
|
81
|
+
// "mjs",
|
|
82
|
+
// "cjs",
|
|
83
|
+
// "jsx",
|
|
84
|
+
// "ts",
|
|
85
|
+
// "tsx",
|
|
86
|
+
// "json",
|
|
87
|
+
// "node"
|
|
88
|
+
// ],
|
|
89
|
+
|
|
90
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
91
|
+
// moduleNameMapper: {},
|
|
92
|
+
|
|
93
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
94
|
+
// modulePathIgnorePatterns: [],
|
|
95
|
+
|
|
96
|
+
// Activates notifications for test results
|
|
97
|
+
// notify: false,
|
|
98
|
+
|
|
99
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
100
|
+
// notifyMode: "failure-change",
|
|
101
|
+
|
|
102
|
+
// A preset that is used as a base for Jest's configuration
|
|
103
|
+
// preset: undefined,
|
|
104
|
+
|
|
105
|
+
// Run tests from one or more projects
|
|
106
|
+
// projects: undefined,
|
|
107
|
+
|
|
108
|
+
// Use this configuration option to add custom reporters to Jest
|
|
109
|
+
// reporters: undefined,
|
|
110
|
+
|
|
111
|
+
// Automatically reset mock state before every test
|
|
112
|
+
// resetMocks: false,
|
|
113
|
+
|
|
114
|
+
// Reset the module registry before running each individual test
|
|
115
|
+
// resetModules: false,
|
|
116
|
+
|
|
117
|
+
// A path to a custom resolver
|
|
118
|
+
// resolver: undefined,
|
|
119
|
+
|
|
120
|
+
// Automatically restore mock state and implementation before every test
|
|
121
|
+
// restoreMocks: false,
|
|
122
|
+
|
|
123
|
+
// The root directory that Jest should scan for tests and modules within
|
|
124
|
+
// rootDir: undefined,
|
|
125
|
+
|
|
126
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
127
|
+
// roots: [
|
|
128
|
+
// "<rootDir>"
|
|
129
|
+
// ],
|
|
130
|
+
|
|
131
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
132
|
+
// runner: "jest-runner",
|
|
133
|
+
|
|
134
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
135
|
+
// setupFiles: [],
|
|
136
|
+
|
|
137
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
138
|
+
// setupFilesAfterEnv: [],
|
|
139
|
+
|
|
140
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
141
|
+
// slowTestThreshold: 5,
|
|
142
|
+
|
|
143
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
144
|
+
// snapshotSerializers: [],
|
|
145
|
+
|
|
146
|
+
// The test environment that will be used for testing
|
|
147
|
+
// testEnvironment: "jest-environment-node",
|
|
148
|
+
|
|
149
|
+
// Options that will be passed to the testEnvironment
|
|
150
|
+
// testEnvironmentOptions: {},
|
|
151
|
+
|
|
152
|
+
// Adds a location field to test results
|
|
153
|
+
// testLocationInResults: false,
|
|
154
|
+
|
|
155
|
+
// The glob patterns Jest uses to detect test files
|
|
156
|
+
// testMatch: [
|
|
157
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
|
158
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
159
|
+
// ],
|
|
160
|
+
|
|
161
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
162
|
+
// testPathIgnorePatterns: [
|
|
163
|
+
// "/node_modules/"
|
|
164
|
+
// ],
|
|
165
|
+
|
|
166
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
167
|
+
// testRegex: [],
|
|
168
|
+
|
|
169
|
+
// This option allows the use of a custom results processor
|
|
170
|
+
// testResultsProcessor: undefined,
|
|
171
|
+
|
|
172
|
+
// This option allows use of a custom test runner
|
|
173
|
+
// testRunner: "jest-circus/runner",
|
|
174
|
+
|
|
175
|
+
// A map from regular expressions to paths to transformers
|
|
176
|
+
// transform: undefined,
|
|
177
|
+
|
|
178
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
179
|
+
// transformIgnorePatterns: [
|
|
180
|
+
// "/node_modules/",
|
|
181
|
+
// "\\.pnp\\.[^\\/]+$"
|
|
182
|
+
// ],
|
|
183
|
+
|
|
184
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
185
|
+
// unmockedModulePathPatterns: undefined,
|
|
186
|
+
|
|
187
|
+
// Indicates whether each individual test should be reported during the run
|
|
188
|
+
// verbose: undefined,
|
|
189
|
+
|
|
190
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
191
|
+
// watchPathIgnorePatterns: [],
|
|
192
|
+
|
|
193
|
+
// Whether to use watchman for file crawling
|
|
194
|
+
// watchman: true,
|
|
195
|
+
};
|