From 11b68e9d019ade037a2c4f0035474a6a64246688 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Thu, 23 Oct 2025 18:23:56 +0100 Subject: [PATCH 1/6] Add Toolkit docs section and navigation support Introduces a new /toolkit/ route for documentation, updates navigation and shared logic to support both Docs and Toolkit sections, and refactors data fetching utilities to handle multiple doc sources. This enables serving and navigating documentation from the 'hwptoolkit' repository alongside the existing FaustJS docs. --- scripts/smart-search.mjs | 6 +- src/components/primary-nav.jsx | 17 ++++++ src/constants/repo.mjs | 5 ++ src/lib/remark-parsing.mjs | 8 ++- src/lib/remote-mdx-files.mjs | 92 +++++++++++++++++++++++-------- src/pages/_app.jsx | 3 +- src/pages/docs/[[...slug]].jsx | 4 +- src/pages/toolkit/[[...slug]].jsx | 47 ++++++++++++++++ 8 files changed, 151 insertions(+), 31 deletions(-) create mode 100644 src/pages/toolkit/[[...slug]].jsx diff --git a/scripts/smart-search.mjs b/scripts/smart-search.mjs index 73715af6..e8344f8a 100644 --- a/scripts/smart-search.mjs +++ b/scripts/smart-search.mjs @@ -48,14 +48,16 @@ async function main() { */ async function collectPages() { const pages = []; - const entries = await getAllDocMeta(); + const docsEntries = await getAllDocMeta("docs"); + const toolkitEntries = await getAllDocMeta("toolkit"); + const entries = [...docsEntries, ...toolkitEntries]; for (const entry of entries) { const entryContent = await getRawDocContent(entry.download_url); const parsedContent = await getTextContentFromMd(entryContent); - const cleanedPath = getDocUriFromPath(entry.path); + const cleanedPath = getDocUriFromPath(entry.path, "docs"); const id = generateDocIdFromUri(cleanedPath); diff --git a/src/components/primary-nav.jsx b/src/components/primary-nav.jsx index faba1ae2..236d6724 100644 --- a/src/components/primary-nav.jsx +++ b/src/components/primary-nav.jsx @@ -52,6 +52,23 @@ export default function PrimaryMenu({ className }) { Docs +
  • + + sendMainNavItemSelectEvent({ + item_id: "/toolkit/", + item_name: "Toolkit", + item_category: "mdx_doc", + }) + } + > + Toolkit + +
  • } */ -export async function getSerializedContextFromMd(mdContent, pageUrl) { +export async function getSerializedContextFromMd( + mdContent, + pageUrl, + type = "docs", +) { return serialize({ source: mdContent, options: { @@ -64,7 +68,7 @@ export async function getSerializedContextFromMd(mdContent, pageUrl) { { selectors: ["img[src]"], inspectEach: ({ url, node }) => { - node.properties.src = getRemoteImgUrl(url, pageUrl); + node.properties.src = getRemoteImgUrl(url, pageUrl, type); }, }, ], diff --git a/src/lib/remote-mdx-files.mjs b/src/lib/remote-mdx-files.mjs index 6e86a100..d3fa2267 100644 --- a/src/lib/remote-mdx-files.mjs +++ b/src/lib/remote-mdx-files.mjs @@ -7,6 +7,10 @@ import { DOCS_REPO, DOCS_BRANCH, DOCS_FOLDER, + TOOLKIT_OWNER, + TOOLKIT_REPO, + TOOLKIT_BRANCH, + TOOLKIT_FOLDER, } from "../constants/repo.mjs"; import { getSerializedContextFromMd } from "./remark-parsing.mjs"; @@ -21,12 +25,39 @@ const octokit = new Octokit({ const DOCS_EXT_REG = /(?.*)index.md(?:x?)$/i; const IMG_PATH_REG = /^(?\.\/)?(?.+)$/i; -const DOCS_PATH = `https://raw.githubusercontent.com/${DOCS_OWNER}/${DOCS_REPO}/refs/heads/${DOCS_BRANCH}/${DOCS_FOLDER}`; +function getRepoConfig(type = "docs") { + switch (type) { + case "toolkit": { + return { + owner: TOOLKIT_OWNER, + repo: TOOLKIT_REPO, + branch: TOOLKIT_BRANCH, + folder: TOOLKIT_FOLDER, + }; + } -const DOCS_NAV_CONFIG_URL = `${DOCS_PATH}/nav.json`; + default: { + return { + owner: DOCS_OWNER, + repo: DOCS_REPO, + branch: DOCS_BRANCH, + folder: DOCS_FOLDER, + }; + } + } +} -function docUrlFromSlug(slug = []) { - return path.join(DOCS_PATH, ...slug, "index.md"); +function getDocsPath(type = "docs") { + const { owner, repo, branch, folder } = getRepoConfig(type); + return `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/${branch}/${folder}`; +} + +function getDocsNavConfigUrl(type = "docs") { + return `${getDocsPath(type)}/nav.json`; +} + +function docUrlFromSlug(slug = [], type = "docs") { + return path.join(getDocsPath(type), ...slug, "index.md"); } /** @@ -34,14 +65,15 @@ function docUrlFromSlug(slug = []) { * * @param {string} imgPath * @param {string[]} pageUrl + * @param {string} type * @returns */ -function imgUrlFromPath(imgPath, pageUrl) { +function imgUrlFromPath(imgPath, pageUrl, type = "docs") { if (!Array.isArray(pageUrl)) { throw new TypeError("pageUrl should be an array"); } - return `${DOCS_PATH}/${pageUrl.join("/")}/${imgPath}`; + return `${getDocsPath(type)}/${pageUrl.join("/")}/${imgPath}`; } /** @@ -49,24 +81,32 @@ function imgUrlFromPath(imgPath, pageUrl) { * * @param {string} localPath * @param {string[]} pageUrl + * @param {string} type * @returns {string} */ -export function getRemoteImgUrl(localPath, pageUrl) { - return imgUrlFromPath(localPath.match(IMG_PATH_REG).groups.slug, pageUrl); +export function getRemoteImgUrl(localPath, pageUrl, type = "docs") { + return imgUrlFromPath( + localPath.match(IMG_PATH_REG).groups.slug, + pageUrl, + type, + ); } /** * Retrieves the metadata for all documents in the docs folder. * + * @param {string} type + * @param {string} pathToFolder */ -export async function getAllDocMeta(pathToFolder = DOCS_FOLDER) { +export async function getAllDocMeta(type = "docs", pathToFolder) { + const { owner, repo, branch, folder } = getRepoConfig(type); const { status, data } = await octokit.request( "GET /repos/{owner}/{repo}/contents/{path}", { - owner: DOCS_OWNER, - repo: DOCS_REPO, - path: pathToFolder, - ref: DOCS_BRANCH, // This makes it so only released features show up in the docs. + owner, + repo, + path: pathToFolder ?? folder, + ref: branch, // This makes it so only released features show up in the docs. }, ); @@ -82,7 +122,7 @@ export async function getAllDocMeta(pathToFolder = DOCS_FOLDER) { if (item.type === "file" && item.name === "index.md") { items.push(item); } else if (item.type === "dir" && item.name !== "images") { - subItems.push(getAllDocMeta(item.path)); + subItems.push(getAllDocMeta(type, item.path)); } } @@ -94,9 +134,10 @@ export async function getAllDocMeta(pathToFolder = DOCS_FOLDER) { /** * Retrieves the nav.json file from the docs folder. * + * @param {string} type */ -export async function getDocsNav() { - const resp = await fetch(DOCS_NAV_CONFIG_URL); +export async function getDocsNav(type = "docs") { + const resp = await fetch(getDocsNavConfigUrl(type)); if (!resp.ok) { throw new Error(resp.statusText); @@ -105,8 +146,8 @@ export async function getDocsNav() { return resp.json(); } -export async function getAllDocUri() { - const data = await getAllDocMeta(); +export async function getAllDocUri(type = "docs") { + const data = await getAllDocMeta(type); if (!Array.isArray(data)) { console.error(data); @@ -116,15 +157,17 @@ export async function getAllDocUri() { const accumulator = []; for (const file of data) { if (DOCS_EXT_REG.test(file.path)) { - accumulator.push(getDocUriFromPath(file.path)); + accumulator.push(getDocUriFromPath(file.path, type)); } } return accumulator; } -export function getDocUriFromPath(ghPath) { - return path.join("/", ghPath.match(DOCS_EXT_REG).groups.slug); +export function getDocUriFromPath(ghPath, type = "docs") { + const { folder } = getRepoConfig(type); + const relativePath = path.relative(folder, ghPath); + return path.join("/", relativePath.match(DOCS_EXT_REG).groups.slug); } /** @@ -152,12 +195,13 @@ export async function getRawDocContent(url) { * Retrieves the parsed content of a document from its slug. * * @param {string} slug + * @param {string} type * @returns {ReturnType} */ -export async function getParsedDoc(slug) { - const content = await getRawDocContent(docUrlFromSlug(slug)); +export async function getParsedDoc(slug, type = "docs") { + const content = await getRawDocContent(docUrlFromSlug(slug, type)); - return getSerializedContextFromMd(content, slug); + return getSerializedContextFromMd(content, slug, type); } /** diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 30c53fd7..5c65bdf0 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -18,6 +18,7 @@ const GA_TRACKING_ID = process.env.NEXT_PUBLIC_GA_TRACKING_ID; export default function MyApp({ Component, pageProps }) { const router = useRouter(); const isDocsRoute = router.pathname.startsWith("/docs"); + const isToolkitRoute = router.pathname.startsWith("/toolkit"); return ( @@ -27,7 +28,7 @@ export default function MyApp({ Component, pageProps }) { {/* eslint-disable-next-line unicorn/no-null */} - {isDocsRoute ? ( + {isDocsRoute || isToolkitRoute ? ( diff --git a/src/pages/docs/[[...slug]].jsx b/src/pages/docs/[[...slug]].jsx index e84eb971..b3a8cd58 100644 --- a/src/pages/docs/[[...slug]].jsx +++ b/src/pages/docs/[[...slug]].jsx @@ -13,8 +13,8 @@ export default function Doc({ source }) { export async function getStaticProps({ params }) { try { - const source = await getParsedDoc(params.slug); - const docsNavData = await getDocsNav(); + const source = await getParsedDoc(params.slug, "docs"); + const docsNavData = await getDocsNav("docs"); return { props: { diff --git a/src/pages/toolkit/[[...slug]].jsx b/src/pages/toolkit/[[...slug]].jsx new file mode 100644 index 00000000..23843d67 --- /dev/null +++ b/src/pages/toolkit/[[...slug]].jsx @@ -0,0 +1,47 @@ +import path from "node:path"; +import { MDXClient } from "next-mdx-remote-client"; +import { getMDXComponents } from "@/components/mdx-components"; +import { + getParsedDoc, + getDocsNav, + generateDocIdFromUri, +} from "@/lib/remote-mdx-files.mjs"; + +export default function Doc({ source }) { + return ; +} + +export async function getStaticProps({ params }) { + try { + const source = await getParsedDoc(params.slug, "toolkit"); + const docsNavData = await getDocsNav("toolkit"); + + return { + props: { + id: generateDocIdFromUri( + params.slug?.length > 1 + ? path.join("/toolkit", ...params.slug, "/") + : "/toolkit/", + ), + source, + docsNavData, + }, + revalidate: 600, + }; + } catch (error) { + if (error.notFound) { + console.error(params, error); + return error; + } + + throw error; + } +} + +export async function getStaticPaths() { + const toolkit_menu_paths = ["/toolkit/"]; + return { + paths: toolkit_menu_paths, + fallback: "blocking", + }; +} From a5d9641ed41d6413a3456721b7ffcfa5ce299b96 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Thu, 23 Oct 2025 20:10:30 +0100 Subject: [PATCH 2/6] Support custom append for toolkit doc routes Adds logic to determine the correct file append (e.g., 'index.md' or other) for toolkit documentation routes based on navigation data. Updates docUrlFromSlug and getParsedDoc to accept an append parameter, and introduces findAppendForRoute to select the appropriate file for each route. --- src/lib/remote-mdx-files.mjs | 45 ++++++++++++++++++++++++++++--- src/pages/toolkit/[[...slug]].jsx | 11 +++++++- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/lib/remote-mdx-files.mjs b/src/lib/remote-mdx-files.mjs index d3fa2267..1b17a465 100644 --- a/src/lib/remote-mdx-files.mjs +++ b/src/lib/remote-mdx-files.mjs @@ -56,8 +56,17 @@ function getDocsNavConfigUrl(type = "docs") { return `${getDocsPath(type)}/nav.json`; } -function docUrlFromSlug(slug = [], type = "docs") { - return path.join(getDocsPath(type), ...slug, "index.md"); +function docUrlFromSlug(slug = [], type = "docs", append = "index.md") { + if (append === "index.md") { + return path.join(getDocsPath(type), ...slug, append); + } + + let url = path.join(getDocsPath(type), ...slug); + if (url.endsWith("/")) { + url = url.slice(0, -1); + } + + return url + append; } /** @@ -196,10 +205,11 @@ export async function getRawDocContent(url) { * * @param {string} slug * @param {string} type + * @param {string} append * @returns {ReturnType} */ -export async function getParsedDoc(slug, type = "docs") { - const content = await getRawDocContent(docUrlFromSlug(slug, type)); +export async function getParsedDoc(slug, type = "docs", append = "index.md") { + const content = await getRawDocContent(docUrlFromSlug(slug, type, append)); return getSerializedContextFromMd(content, slug, type); } @@ -213,3 +223,30 @@ export async function getParsedDoc(slug, type = "docs") { export function generateDocIdFromUri(uri) { return `mdx:${hash("sha-1", uri)}`; } + +/** + * Finds the append for a route in the docs nav data. + * + * @param {Array} items + * @param {string} currentRoute + * @returns {string} + */ +export function findAppendForRoute(items, currentRoute) { + const defaultAppend = "index.md"; + if (!Array.isArray(items)) { + return defaultAppend; + } + + for (const item of items) { + if (item?.route === currentRoute) { + return item.append ?? defaultAppend; + } + + if (Array.isArray(item?.children)) { + const found = findAppendForRoute(item.children, currentRoute); + if (found) return found; + } + } + + return defaultAppend; +} diff --git a/src/pages/toolkit/[[...slug]].jsx b/src/pages/toolkit/[[...slug]].jsx index 23843d67..21543305 100644 --- a/src/pages/toolkit/[[...slug]].jsx +++ b/src/pages/toolkit/[[...slug]].jsx @@ -5,6 +5,7 @@ import { getParsedDoc, getDocsNav, generateDocIdFromUri, + findAppendForRoute, } from "@/lib/remote-mdx-files.mjs"; export default function Doc({ source }) { @@ -13,9 +14,17 @@ export default function Doc({ source }) { export async function getStaticProps({ params }) { try { - const source = await getParsedDoc(params.slug, "toolkit"); const docsNavData = await getDocsNav("toolkit"); + const currentRoute = + params.slug?.length > 1 + ? path.join("/toolkit", ...params.slug, "/") + : "/toolkit/"; + + const append = findAppendForRoute(docsNavData, currentRoute); + + const source = await getParsedDoc(params.slug, "toolkit", append); + return { props: { id: generateDocIdFromUri( From a60175fd5ca9348314176990c78bb6a5141d93af Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Thu, 23 Oct 2025 20:21:31 +0100 Subject: [PATCH 3/6] Fixed eslint error. --- src/lib/remote-mdx-files.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/remote-mdx-files.mjs b/src/lib/remote-mdx-files.mjs index 1b17a465..4b2739ce 100644 --- a/src/lib/remote-mdx-files.mjs +++ b/src/lib/remote-mdx-files.mjs @@ -107,7 +107,7 @@ export function getRemoteImgUrl(localPath, pageUrl, type = "docs") { * @param {string} type * @param {string} pathToFolder */ -export async function getAllDocMeta(type = "docs", pathToFolder) { +export async function getAllDocMeta(type, pathToFolder) { const { owner, repo, branch, folder } = getRepoConfig(type); const { status, data } = await octokit.request( "GET /repos/{owner}/{repo}/contents/{path}", From fdf572c862f3aeec15e22d339e2362bd18f1693d Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Fri, 7 Nov 2025 14:09:35 +0000 Subject: [PATCH 4/6] Removed append as re-structured HWP Toolkit docs. Also updated it to use a POC branch for testing while updating the logging docs. --- src/components/on-this-page-nav.jsx | 2 +- src/constants/repo.mjs | 2 +- src/lib/remote-mdx-files.mjs | 45 +++-------------------------- src/pages/toolkit/[[...slug]].jsx | 11 +------ 4 files changed, 7 insertions(+), 53 deletions(-) diff --git a/src/components/on-this-page-nav.jsx b/src/components/on-this-page-nav.jsx index 56d9a006..bdfd91e9 100644 --- a/src/components/on-this-page-nav.jsx +++ b/src/components/on-this-page-nav.jsx @@ -30,7 +30,7 @@ export default function OnThisPageNav({ headings }) { return ( <>

    On This Page

    - {headings.length > 0 && ( + {headings && headings.length > 0 && (
      {headings.map((heading) => (
    • } */ -export async function getParsedDoc(slug, type = "docs", append = "index.md") { - const content = await getRawDocContent(docUrlFromSlug(slug, type, append)); +export async function getParsedDoc(slug, type = "docs") { + const content = await getRawDocContent(docUrlFromSlug(slug, type)); return getSerializedContextFromMd(content, slug, type); } @@ -223,30 +213,3 @@ export async function getParsedDoc(slug, type = "docs", append = "index.md") { export function generateDocIdFromUri(uri) { return `mdx:${hash("sha-1", uri)}`; } - -/** - * Finds the append for a route in the docs nav data. - * - * @param {Array} items - * @param {string} currentRoute - * @returns {string} - */ -export function findAppendForRoute(items, currentRoute) { - const defaultAppend = "index.md"; - if (!Array.isArray(items)) { - return defaultAppend; - } - - for (const item of items) { - if (item?.route === currentRoute) { - return item.append ?? defaultAppend; - } - - if (Array.isArray(item?.children)) { - const found = findAppendForRoute(item.children, currentRoute); - if (found) return found; - } - } - - return defaultAppend; -} diff --git a/src/pages/toolkit/[[...slug]].jsx b/src/pages/toolkit/[[...slug]].jsx index 21543305..0af3d530 100644 --- a/src/pages/toolkit/[[...slug]].jsx +++ b/src/pages/toolkit/[[...slug]].jsx @@ -5,7 +5,6 @@ import { getParsedDoc, getDocsNav, generateDocIdFromUri, - findAppendForRoute, } from "@/lib/remote-mdx-files.mjs"; export default function Doc({ source }) { @@ -15,15 +14,7 @@ export default function Doc({ source }) { export async function getStaticProps({ params }) { try { const docsNavData = await getDocsNav("toolkit"); - - const currentRoute = - params.slug?.length > 1 - ? path.join("/toolkit", ...params.slug, "/") - : "/toolkit/"; - - const append = findAppendForRoute(docsNavData, currentRoute); - - const source = await getParsedDoc(params.slug, "toolkit", append); + const source = await getParsedDoc(params.slug, "toolkit"); return { props: { From 02fefcf22eca84c21ad3548c263b6fee212dc694 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Tue, 11 Nov 2025 12:26:04 +0000 Subject: [PATCH 5/6] Added ability to fetch files locally for a quicker feedback loop when testing markdown files locally. --- src/lib/remote-mdx-files.mjs | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/lib/remote-mdx-files.mjs b/src/lib/remote-mdx-files.mjs index ad187a6c..fe0b3280 100644 --- a/src/lib/remote-mdx-files.mjs +++ b/src/lib/remote-mdx-files.mjs @@ -1,4 +1,5 @@ import { hash } from "node:crypto"; +import fs from "node:fs/promises"; import path from "node:path"; import { env } from "node:process"; import { Octokit } from "@octokit/core"; @@ -48,6 +49,11 @@ function getRepoConfig(type = "docs") { } function getDocsPath(type = "docs") { + if (env.USE_LOCAL_FILES) { + const { folder: docsFolder } = getRepoConfig(type); + return path.join(env.LOCAL_FILE_PATH, docsFolder); + } + const { owner, repo, branch, folder } = getRepoConfig(type); return `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/${branch}/${folder}`; } @@ -92,6 +98,46 @@ export function getRemoteImgUrl(localPath, pageUrl, type = "docs") { ); } +/** + * Helper function to get local file metadata + * + * @param {string} type + * @param {string} pathToFolder + */ +async function getLocalDocMeta(type, pathToFolder) { + const { folder: docsFolder } = getRepoConfig(type); + const basePath = pathToFolder + ? path.join(env.LOCAL_FILE_PATH, pathToFolder) + : path.join(env.LOCAL_FILE_PATH, docsFolder); + + const localItems = []; + const localSubItems = []; + + const entries = await fs.readdir(basePath, { withFileTypes: true }); + + for (const entry of entries) { + if (entry.isFile() && entry.name === "index.md") { + const relativePath = pathToFolder + ? path.join(pathToFolder, entry.name) + : path.join(docsFolder, entry.name); + localItems.push({ + type: "file", + name: entry.name, + path: relativePath, + }); + } else if (entry.isDirectory() && entry.name !== "images") { + const subPath = pathToFolder + ? path.join(pathToFolder, entry.name) + : path.join(docsFolder, entry.name); + localSubItems.push(getAllDocMeta(type, subPath)); + } + } + + const localSubFolderItems = await Promise.all(localSubItems); + + return [...localItems, ...localSubFolderItems.flat()]; +} + /** * Retrieves the metadata for all documents in the docs folder. * @@ -99,6 +145,10 @@ export function getRemoteImgUrl(localPath, pageUrl, type = "docs") { * @param {string} pathToFolder */ export async function getAllDocMeta(type, pathToFolder) { + if (env.USE_LOCAL_FILES) { + return getLocalDocMeta(type, pathToFolder); + } + const { owner, repo, branch, folder } = getRepoConfig(type); const { status, data } = await octokit.request( "GET /repos/{owner}/{repo}/contents/{path}", @@ -137,6 +187,12 @@ export async function getAllDocMeta(type, pathToFolder) { * @param {string} type */ export async function getDocsNav(type = "docs") { + if (env.USE_LOCAL_FILES) { + const navPath = getDocsNavConfigUrl(type); + const content = await fs.readFile(navPath, "utf8"); + return JSON.parse(content); + } + const resp = await fetch(getDocsNavConfigUrl(type)); if (!resp.ok) { @@ -177,6 +233,19 @@ export function getDocUriFromPath(ghPath, type = "docs") { * @returns {Promise} */ export async function getRawDocContent(url) { + if (env.USE_LOCAL_FILES) { + try { + return await fs.readFile(url, "utf8"); + } catch (error) { + if (error.code === "ENOENT") { + // eslint-disable-next-line no-throw-literal + throw { notFound: true }; + } + + throw error; + } + } + const resp = await fetch(url); if (!resp.ok) { From f52abbc8ced45d0a0977e125db00d65df9b7bb01 Mon Sep 17 00:00:00 2001 From: Colin Murphy Date: Tue, 11 Nov 2025 14:16:52 +0000 Subject: [PATCH 6/6] Simplified the lcoal dev process to only needing LOCAL_FILE_PATH --- src/lib/remote-mdx-files.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/remote-mdx-files.mjs b/src/lib/remote-mdx-files.mjs index fe0b3280..4d0e3626 100644 --- a/src/lib/remote-mdx-files.mjs +++ b/src/lib/remote-mdx-files.mjs @@ -49,7 +49,7 @@ function getRepoConfig(type = "docs") { } function getDocsPath(type = "docs") { - if (env.USE_LOCAL_FILES) { + if (env.LOCAL_FILE_PATH) { const { folder: docsFolder } = getRepoConfig(type); return path.join(env.LOCAL_FILE_PATH, docsFolder); } @@ -145,7 +145,7 @@ async function getLocalDocMeta(type, pathToFolder) { * @param {string} pathToFolder */ export async function getAllDocMeta(type, pathToFolder) { - if (env.USE_LOCAL_FILES) { + if (env.LOCAL_FILE_PATH) { return getLocalDocMeta(type, pathToFolder); } @@ -187,7 +187,7 @@ export async function getAllDocMeta(type, pathToFolder) { * @param {string} type */ export async function getDocsNav(type = "docs") { - if (env.USE_LOCAL_FILES) { + if (env.LOCAL_FILE_PATH) { const navPath = getDocsNavConfigUrl(type); const content = await fs.readFile(navPath, "utf8"); return JSON.parse(content); @@ -233,7 +233,7 @@ export function getDocUriFromPath(ghPath, type = "docs") { * @returns {Promise} */ export async function getRawDocContent(url) { - if (env.USE_LOCAL_FILES) { + if (env.LOCAL_FILE_PATH) { try { return await fs.readFile(url, "utf8"); } catch (error) {