ci: typecheck code samples in docs (#25777)

This commit is contained in:
Anthony Fu 2024-02-15 11:07:39 +01:00 committed by GitHub
parent 1901cb1c68
commit 3f882c95f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 1097 additions and 2 deletions

View File

@ -134,6 +134,9 @@ jobs:
env: env:
MODULE_RESOLUTION: ${{ matrix.module }} MODULE_RESOLUTION: ${{ matrix.module }}
- name: Typecheck (docs)
run: pnpm typecheck:docs
lint: lint:
# autofix workflow will be triggered instead for PRs # autofix workflow will be triggered instead for PRs
if: github.event_name == 'push' if: github.event_name == 'push'

View File

@ -32,3 +32,9 @@ jobs:
- name: Lint (docs) - name: Lint (docs)
run: pnpm lint:docs run: pnpm lint:docs
- name: Build Nuxt
run: pnpm build
- name: Typecheck (docs)
run: pnpm typecheck:docs

View File

@ -1 +1,3 @@
telemetry.enabled=false telemetry.enabled=false
# For pnpm typecheck:docs to generate correct types
pages=true

View File

@ -327,6 +327,7 @@ definePageMeta({
mode: 'out-in' mode: 'out-in'
}, },
middleware (to, from) { middleware (to, from) {
if (to.meta.pageTransition && typeof to.meta.pageTransition !== 'boolean')
to.meta.pageTransition.name = +to.params.id > +from.params.id ? 'slide-left' : 'slide-right' to.meta.pageTransition.name = +to.params.id > +from.params.id ? 'slide-left' : 'slide-right'
} }
}) })

View File

@ -29,7 +29,8 @@
"test:runtime": "vitest -c vitest.nuxt.config.ts --coverage", "test:runtime": "vitest -c vitest.nuxt.config.ts --coverage",
"test:types": "pnpm --filter './test/fixtures/**' test:types", "test:types": "pnpm --filter './test/fixtures/**' test:types",
"test:unit": "vitest run packages/ --coverage", "test:unit": "vitest run packages/ --coverage",
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit",
"typecheck:docs": "nuxi prepare && nuxt-content-twoslash verify --content-dir docs"
}, },
"resolutions": { "resolutions": {
"@nuxt/kit": "workspace:*", "@nuxt/kit": "workspace:*",
@ -71,6 +72,7 @@
"nitropack": "2.8.1", "nitropack": "2.8.1",
"nuxi": "3.10.1", "nuxi": "3.10.1",
"nuxt": "workspace:*", "nuxt": "workspace:*",
"nuxt-content-twoslash": "^0.0.4",
"ofetch": "1.3.3", "ofetch": "1.3.3",
"pathe": "1.1.2", "pathe": "1.1.2",
"playwright-core": "1.41.2", "playwright-core": "1.41.2",

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url'
const testWithInlineVue = process.env.EXTERNAL_VUE === 'false' const testWithInlineVue = process.env.EXTERNAL_VUE === 'false'
export default defineNuxtConfig({ export default defineNuxtConfig({
pages: false,
experimental: { experimental: {
externalVue: !testWithInlineVue externalVue: !testWithInlineVue
}, },

View File

@ -10,6 +10,7 @@ export default defineVitestConfig({
environmentOptions: { environmentOptions: {
nuxt: { nuxt: {
overrides: { overrides: {
pages: false,
appConfig: { appConfig: {
nuxt: { nuxt: {
buildId: 'override' buildId: 'override'