Repository navigation
docs: move the docs site to TypeScript and script setup - #8248
Merged
Merged
Conversation
- 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.tswith types; the last four.vuepages withoutlang="ts"(changelog, vue3) get it.build/vite-plugin-index-tranform.tspoints at the renamed entries, anddemo/env.d.tsdeclares the.mdpage modules.build/loaders/test/testMdLoader.jsandtestDemoLoader.jsloadNaiveUIMdLoader, which no longer exists, and nothing runs them.demo/utils/composables.jsshadowedcomposables.ts: Vite resolves.jsbefore.ts, so the TypeScript version was never used.tsconfig.site.jsoncoversdemo/andbuild/, run bylint:site-typeas part ofpnpm lint. Until now CI only type-checkedsrc/, so the site'slang="ts"files went unchecked. The 31 errors this surfaced are fixed (mostly implicitanyand nullable template refs inSiteHeader.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 fromdefineComponentand 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 underdemo/pages/docs/theme/(user-facing example code) andbuild/loaders/ComponentDemoTemplate.vue(the loader's template).Tests
vue-tsc -p tsconfig.site.json: 0 errors.eslint demo build: clean.vitest run build: passes./<lang>/<theme>/...redirects.