Skip to content

docs: move the docs site to TypeScript and script setup - #8248

Merged
Sepush merged 2 commits into
tusen-ai:docsfrom
Sepush:docs-site-ts
Oct 26, 2026
Merged

Sepush merged 2 commits into
tusen-ai:docsfrom
Sepush:docs-site-ts

Conversation

@Sepush

@Sepush Sepush commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Moves the docs site's remaining JavaScript to TypeScript, type-checks the site, and writes its components with <script setup lang="ts">. No behavior change.

Changes

  • JS → TS (demo/): entries (index.dev, index.prod, setup), routes (routes, router), store (index, menu-options, hljs) and utils (color-mode, codesandbox, playground, route, github-url) are now .ts with types; the last four .vue pages without lang="ts" (changelog, vue3) get it. build/vite-plugin-index-tranform.ts points at the renamed entries, and demo/env.d.ts declares the .md page modules.
  • Dead code removed:
    • build/loaders/test/testMdLoader.js and testDemoLoader.js load NaiveUIMdLoader, which no longer exists, and nothing runs them.
    • demo/utils/composables.js shadowed composables.ts: Vite resolves .js before .ts, so the TypeScript version was never used.
  • Type checking the site: tsconfig.site.json covers demo/ and build/, run by lint:site-type as part of pnpm lint. Until now CI only type-checked src/, so the site's lang="ts" files went unchecked. The 31 errors this surfaced are fixed (mostly implicit any and nullable template refs in SiteHeader.vue, Layout.vue, ComponentDemo.vue).
  • <script setup>: the site's own components (SiteHeader, SiteRoot, Site, Layout, home page and footer, ComponentDemo, the copy / edit / CodeSandbox / Playground buttons, EditOnGithubHeader, CopyMarkdownButton, the changelog and vue3 pages) move from defineComponent and the Options API (home page) to <script setup lang="ts"> with typed props. Names used by templates are kept, so templates don't change. Left as they are: the example demos under demo/pages/docs/theme/ (user-facing example code) and build/loaders/ComponentDemoTemplate.vue (the loader's template).

Tests

  • vue-tsc -p tsconfig.site.json: 0 errors. eslint demo build: clean. vitest run build: passes.
  • Production build of the site, and a browser check of the dev server and the build:
    • Home: theme button, Get Started, llms.txt hint, footer links.
    • Header: language switch on home / docs / component pages, theme picker, search, logo, mobile menu.
    • Button page: 18 demos, show code, TS/JS tabs, copy code, Edit on GitHub, CodeSandbox and Playground buttons, copy Markdown.
    • Other pages: changelog in both languages, theme docs page, menu counts and navigation, legacy /<lang>/<theme>/... redirects.
    • No page or console errors.

- Convert demo/ entries, routes, store and utils to typed .ts, and give
  the last four .vue pages lang="ts"; types only, no behavior change
- Remove dead code: build/loaders/test/*.js (they load a module that no
  longer exists) and demo/utils/composables.js, which shadowed its .ts
  twin because Vite resolves .js first
- Type-check the docs site: tsconfig.site.json covers demo/ and build/,
  run by lint:site-type as part of lint
Move the site's own components from defineComponent and the Options API
to <script setup lang="ts"> with typed props. No behavior change. The
example demos and the loader's demo template stay as they are.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.56%. Comparing base (3940323) to head (cb1e54b).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             docs    #8248   +/-   ##
=======================================
  Coverage   63.56%   63.56%           
=======================================
  Files         878      878           
  Lines       27487    27487           
  Branches     8750     8750           
=======================================
  Hits        17471    17471           
  Misses       9803     9803           
  Partials      213      213           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Sepush
Sepush merged commit bc29787 into tusen-ai:docs Oct 26, 2026
3 checks passed
@Sepush
Sepush deleted the docs-site-ts branch October 26, 2026 04:10

This branch was previously deployed

1 inactive deployment
test — cb1e54b4 Deployed Oct 25, 2026 by Sepush via test-browser (24) #11275
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