Skip to content

fix: fetch-sources passes file path to parseFrontmatter (expects raw text)#101

Merged
ronaldtse merged 1 commit into
mainfrom
fix/fetch-sources-frontmatter
Jul 23, 2026
Merged

fix: fetch-sources passes file path to parseFrontmatter (expects raw text)#101
ronaldtse merged 1 commit into
mainfrom
fix/fetch-sources-frontmatter

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Regression introduced in PR #100 (the architecture refactor). When I extracted the YAML-front-matter parser to src/lib/frontmatter.mjs, I kept its interface as parseFrontmatter(rawText) — but in fetch-sources.mjs I called it as parseFrontmatter(filePath). The regex matched nothing, every product's docs_repo came back undefined, every product hit the continue, and vendor/ stayed empty.

CI then built with no vendor checkout, so the softwareDocs and manpages collections were empty, ~970 internal doc/manpage links went missing, and lychee reported 8 broken internal links (the README and installation hrefs that had nothing to point at).

The live site deployed from this broken build.

Fix

- const fm = parseFrontmatter(join(softwareDir, file)).frontMatter;
+ const fm = parseFrontmatter(readFileSync(join(softwareDir, file), 'utf8')).frontMatter;

Matching what asciidoc.ts already does through its adocLoader.

Test plan

  • parseFrontmatter(readFileSync('src/content/software/rnp.md', 'utf8')) returns docs_repo + docs_ref correctly
  • rm -rf vendor && npm run fetch-sources clones all 3 products (py-rnp, rnp@v0.18.1, ruby-rnp)
  • npm run build: no "collection does not exist or is empty" warnings
  • npm run check:links: "OK — all internal href/src targets exist in dist/."
  • CI: next build repopulates vendor/, links job goes green, redeploy fixes the live site

…text)

Regression introduced in PR #100 (the architecture refactor). When I
extracted the YAML-front-matter parser to src/lib/frontmatter.mjs, I
kept its interface as `parseFrontmatter(rawText)` — but in
fetch-sources.mjs I called it as `parseFrontmatter(filePath)`. The
regex matched nothing, every product's `docs_repo` came back undefined,
every product hit the `continue`, and `vendor/` stayed empty.

CI then built with no vendor checkout, so the `softwareDocs` and
`manpages` collections were empty, ~970 internal doc/manpage links went
missing, and lychee reported 8 broken internal links (the README and
installation hrefs that had nothing to point at).

The live site deployed from this broken build.

Fix: readFileSync(join(softwareDir, file), 'utf8') before calling
parseFrontmatter, matching what asciidoc.ts already does through its
adocLoader.

Verified locally:
  - parseFrontmatter(readFileSync('src/content/software/rnp.md', 'utf8'))
    returns docs_repo + docs_ref correctly
  - rm -rf vendor && npm run fetch-sources clones all 3 products
  - npm run build: no empty-collection warnings
  - npm run check:links: "OK — all internal href/src targets exist"
@ronaldtse
ronaldtse merged commit 866effd into main Jul 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant