Skip to content

docs: build a VitePress site beside VuePress - #12445

Open
kurkle wants to merge 2 commits into
chartjs:masterfrom
kurkle:migrate-docs-to-vitepress-p2-vitepress-beside-vuepress
Open

kurkle wants to merge 2 commits into
chartjs:masterfrom
kurkle:migrate-docs-to-vitepress-p2-vitepress-beside-vuepress

Conversation

@kurkle

@kurkle kurkle commented Nov 24, 2026

Copy link
Copy Markdown
Member

Advances #10583. This is piece P2 of the design in openspec/changes/migrate-docs-to-vitepress.

What was missing

No VitePress build of the docs existed. The later pieces (sidebar, API reference, redirects, version menu, live samples, and then the switch) need a site to build on. VuePress keeps building and deploying the docs until the switch.

What changed

  • New root scripts
    • pnpm run docs:vitepress builds the library, then the guide pages into docs/.vitepress/dist.
    • docs:vitepress:dev runs the dev server.
    • docs:typecheck runs vue-tsc --noEmit over the docs' TypeScript.
  • A temporary workspace package, docs/.vitepress/package.json
    • It owns VitePress 1.6.4, Vue 3, markdown-it-include, TypeScript 6.0 and vue-tsc.
    • Its scripts are site:build, site:dev and typecheck. The root --filter "./docs/**" does not select it either.
    • It is "type": "module". Without that, VitePress loads config.ts as CommonJS and fails on the ESM-only vitepress.
  • docs/.vitepress/config.ts
    • Site settings: title, description, the base from docs-version.json, the favicon under the base, and the nav (Home, API, Samples, Ecosystem).
    • Also: the GitHub link, "Last updated", local search, and light scheme only.
    • Markdown: includes via markdown-it-include, and duplicate-heading anchors as today (#animations-2).
    • Not published: partials (**/_*.md) and, until the API piece, api/**. Without the api/** exclusion, a build after pnpm run docs publishes the 126 TypeDoc pages VuePress left in docs/api.
    • Dead-link exemptions for localhost and, until the API piece, links into api/.
    • Aliases: chart.js → dist/chart.js, plus two temporary aliases that point vue and vue/server-renderer at the Vue 3 package. docs/package.json still pins Vue 2.
  • Theme and assets: a theme entry that extends the default theme, the brand palette, and the favicon and logos copied to docs/public/.
  • scripts/docs-config.sh also writes the tag to docs/.vitepress/docs-version.json, beside the existing sed. No workflow changes.
  • .gitignore: VitePress's cache, .temp and dist.
  • Design: design.md and tasks.md record what this piece measured, and tasks 2.x are ticked.
  • Release-age exclusion: resolving the lockfile moves the auto-installed chart.js peer to 4.6.2, which is still inside pnpm's minimumReleaseAge window. So pnpm-workspace.yaml excludes chart.js@4.6.2. The entry is stale after 2026-11-24 19:23 UTC and is removed in the clean-up piece (D22).

Evidence

Before, on cdfab70:

$ pnpm run docs:vitepress
Error: ERR_PNPM_NO_SCRIPT
  × Missing script: docs:vitepress

After:

  • pnpm run docs:vitepress: "build complete", 135 pages. These output checks pass:

    • getting-started/usage.html exists and axes/_common.html does not.
    • configuration/animations.html has id="animations-2".
    • charts/bar.html has a tip callout and a copy button.
    • axes/cartesian/linear.html contains "Common options to all cartesian axes".
    • Pages show "Last updated" and the GitHub link.
    • Assets and favicon are under /docs/master/, and there is no appearance switch.
  • ./scripts/docs-config.sh writes these markers. A build with next links only under /docs/next/.

    Arguments Marker
    master master
    4.6.2 release 4.6.2
    4.6.2 latest
    4.7.0-beta.1 next
  • pnpm run docs:typecheck passes. With lastUpdated: 42 in the config it fails with TS2322: Type 'number' is not assignable to type 'boolean | undefined'.

  • pnpm run docs (VuePress), run after a VitePress build: it still writes the same site to dist/docs, and pnpm pack --dry-run lists no docs file.

  • pnpm install --frozen-lockfile passes the supply-chain policy check.

How to try it

pnpm install
pnpm run docs:vitepress      # output in docs/.vitepress/dist
pnpm run docs:vitepress:dev  # http://localhost:5173/docs/master/
pnpm run docs:typecheck

Until later pieces land, the site has no sidebar, API reference or live samples, and the three tab pages show literal :::: tabs text.

`pnpm run docs:vitepress` builds the guide pages with VitePress into
docs/.vitepress/dist, while `pnpm run docs` keeps building and deploying
the VuePress site. The VitePress dependencies live in a temporary workspace
package, docs/.vitepress/package.json, until the site replaces VuePress.

The config takes its base from docs/.vitepress/docs-version.json, which
scripts/docs-config.sh now writes beside the VuePress sed. Partials and the
VuePress TypeDoc output in docs/api are not published, and links into the
API reference are ignored until this site generates it.
`pnpm run docs:typecheck` checks the docs' TypeScript with vue-tsc.

Resolving the lockfile moves the auto-installed chart.js peer to 4.6.2,
which is still inside pnpm's minimumReleaseAge window, so
pnpm-workspace.yaml excludes chart.js@4.6.2 until the clean-up removes it.

Part of chartjs#10583
@netlify

netlify Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for chartjs-docs canceled.

Name Link
🔨 Latest commit 096d8de
🔍 Latest deploy log https://app.netlify.com/projects/chartjs-docs/deploys/6b0504c1c416d893af36eaaf

@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 361 kB

ℹ️ View Unchanged
Filename Size
dist/chart.cjs 81.4 kB
dist/chart.js 81.7 kB
dist/chart.umd.js 72.1 kB
dist/chart.umd.min.js 72.1 kB
dist/chunks/helpers.dataset.cjs 25.7 kB
dist/chunks/helpers.dataset.js 25.5 kB
dist/helpers.cjs 1.52 kB
dist/helpers.js 1.33 kB

compressed-size-action

The config excludes `api/**` until the API piece, as D6 and the P2 row
say; the task now says so too.
@kurkle
kurkle marked this pull request as ready for review November 24, 2026 03:40
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.

2 participants