Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jescalan committed Mar 6, 2025
1 parent 322c333 commit 0727b64
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/build-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ const parseInMarkdownFile =
return
}

// this could be done as part of the partial reading instead of here
const partialContentVFile = markdownProcessor()
.use(() => (tree, vfile) => {
mdastVisit(
Expand Down Expand Up @@ -609,6 +610,7 @@ export const build = async (store: ReturnType<typeof createBlankStore>, config:
const partials = await getPartialsMarkdown((await getPartialsFolder()).map((item) => item.path))
console.info('✔️ Read Partials')

// slightly confusing variable naming
const guides = new Map<string, Awaited<ReturnType<typeof parseMarkdownFile>>>()
const guidesInManifest = new Set<string>()

Expand All @@ -632,6 +634,7 @@ export const build = async (store: ReturnType<typeof createBlankStore>, config:
docsFiles.map(async (file) => {
const href = removeMdxSuffix(`/docs/${file.path}`)

// maybe don't need caching here?
const alreadyLoaded = guides.get(href)

if (alreadyLoaded) return null // already processed
Expand All @@ -640,6 +643,7 @@ export const build = async (store: ReturnType<typeof createBlankStore>, config:

let markdownFile: Awaited<ReturnType<typeof parseMarkdownFile>>

// maybe don't need caching here?
const cachedMarkdownFile = store.markdownFiles.get(href)

if (cachedMarkdownFile) {
Expand Down Expand Up @@ -894,6 +898,7 @@ type BuildConfigOptions = {

type BuildConfig = ReturnType<typeof createConfig>

// This is what this function does, and why!?
export function createConfig(config: BuildConfigOptions) {
const resolve = (relativePath: string) => {
return path.isAbsolute(relativePath) ? relativePath : path.join(config.basePath, relativePath)
Expand Down

0 comments on commit 0727b64

Please sign in to comment.