fix(docs): pin builddocs to 1.x to fix api docs build - #2442
Conversation
builddocs 2.x is an incompatible rewrite: the `build()` function was replaced by `buildDocs()`, which emits HTML and drops the markdown output and template support the docs script relies on. #2404 bumped it from ^1.0.8 to ^2.0.0, breaking `pnpm -F @milkdown/docs run build` with "import_builddocs.build is not a function". Pin back to ^1.0.9 and add a renovate rule to block builddocs major upgrades until the script is migrated.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
There was a problem hiding this comment.
Pull request overview
This PR fixes the @milkdown/docs API docs build by reverting builddocs back to the compatible 1.x API (which provides build({ ... , format: 'markdown', templates })) and preventing Renovate from proposing future major upgrades that would break the current markdown/template-based docs generation.
Changes:
- Pin
docsworkspacebuilddocsdependency from^2.xback to^1.0.9(keeps<2.0.0). - Add a Renovate package rule to disable major updates for
builddocs. - Update
pnpm-lock.yamlto reflect thebuilddocs@1.0.9dependency graph.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
docs/package.json |
Pins builddocs to the 1.x line required by the current docs build script. |
.github/renovate.json |
Adds a Renovate rule to block builddocs major upgrades that would break the markdown/templates workflow. |
pnpm-lock.yaml |
Re-locks dependencies to builddocs@1.0.9 and its transitive deps. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@milkdown/components
@milkdown/core
@milkdown/crepe
@milkdown/ctx
@milkdown/exception
@milkdown/kit
@milkdown/prose
@milkdown/transformer
@milkdown/utils
@milkdown/react
@milkdown/vue
@milkdown/plugin-automd
@milkdown/plugin-block
@milkdown/plugin-clipboard
@milkdown/plugin-collab
@milkdown/plugin-cursor
@milkdown/plugin-diff
@milkdown/plugin-emoji
@milkdown/plugin-highlight
@milkdown/plugin-history
@milkdown/plugin-indent
@milkdown/plugin-listener
@milkdown/plugin-prism
@milkdown/plugin-slash
@milkdown/plugin-streaming
@milkdown/plugin-tooltip
@milkdown/plugin-trailing
@milkdown/plugin-upload
@milkdown/preset-commonmark
@milkdown/preset-gfm
@milkdown/theme-nord
commit: |
- Add @sanitizeLinkHref to the preset-commonmark api template (public export from #2410 that was missing from the doc template). - Exit non-zero when any module fails to build. The script previously logged per-module failures but always resolved, so a broken api docs build (e.g. the builddocs bump) exited 0 and slipped past ci. - Run the api docs build as an explicit step in the ci build job so regressions are caught.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
.github/workflows/ci.yml:69
- The new "Build API docs" step duplicates work:
pnpm buildalready runspnpm -r run build(rootpackage.json), which includes@milkdown/docs'sbuildscript. Now thatdocs/src/index.tssets a non-zero exit code on failure, the existingpnpm buildstep should already fail CI when docs generation breaks. Consider either removing this extra step, or adjusting the earlier build step to exclude docs so it only runs once.
- name: Build packages
run: pnpm build
- name: Build API docs
run: pnpm --filter=@milkdown/docs run build
Summary
pnpm -F @milkdown/docs run buildcurrently fails for every module with:Root cause: #2404 ("bump up all dependencies") upgraded
builddocsfrom^1.0.8to^2.0.0. builddocs 2.x is an incompatible rewrite — thebuild({ name, filename, main, format, templates })function was replaced bybuildDocs({ modules, renderMarkdown, ... }), which emits HTML (ModuleDocs[].text = builder.html) and drops both the markdown output (format: 'markdown') and thetemplatesmechanism the docs script relies on to generatedocs/lib/*.md. Migrating to 2.x would change the generated output from markdown to HTML and require rewriting the consumers — out of scope for a build fix.This PR also fixes why CI never caught the break: the docs build already runs in the
buildjob (viapnpm -r run build), butdocs/src/index.tslogged each module failure and then resolved anyway, so the process exited0even when all 24 modules failed.Changes
docs/package.json: pinbuilddocs^2.0.0→^1.0.9(restores the markdown-producing 1.x API)..github/renovate.json: blockbuilddocsmajor upgrades so it isn't auto-bumped back to the incompatible 2.x (patches within 1.x still flow).docs/src/index.ts: exit non-zero when any module fails to build, so a broken build actually fails instead of silently exiting 0.docs/api/preset-commonmark.md: add@sanitizeLinkHrefto the template — a public export added in fix: sanitize unsafe link hrefs and emoji html to prevent stored XSS #2410 that was missing from the doc template (previously loggedItem sanitizeLinkHref is missing from the doc template)..github/workflows/ci.yml: run the api docs build as an explicit, named step in thebuildjob so regressions are caught going forward.pnpm-lock.yaml: relock.How did you test this change?
Success path — all modules build, exit
0:No more
sanitizeLinkHrefwarning, and it renders in the output:Failure now actually fails (temporarily broke the template dir to force it):
oxlintandtsc -b docs/tsconfig.jsonboth pass clean.