Skip to content

Commit

Permalink
ci: typecheck code samples in docs (#25777)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 15, 2024
1 parent 1901cb1 commit 3f882c9
Show file tree
Hide file tree
Showing 8 changed files with 1,097 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ jobs:
env:
MODULE_RESOLUTION: ${{ matrix.module }}

- name: Typecheck (docs)
run: pnpm typecheck:docs

lint:
# autofix workflow will be triggered instead for PRs
if: github.event_name == 'push'
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ jobs:

- name: Lint (docs)
run: pnpm lint:docs

- name: Build Nuxt
run: pnpm build

- name: Typecheck (docs)
run: pnpm typecheck:docs
2 changes: 2 additions & 0 deletions .nuxtrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
telemetry.enabled=false
# For pnpm typecheck:docs to generate correct types
pages=true
3 changes: 2 additions & 1 deletion docs/1.getting-started/5.transitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ definePageMeta({
mode: 'out-in'
},
middleware (to, from) {
to.meta.pageTransition.name = +to.params.id > +from.params.id ? 'slide-left' : 'slide-right'
if (to.meta.pageTransition && typeof to.meta.pageTransition !== 'boolean')
to.meta.pageTransition.name = +to.params.id > +from.params.id ? 'slide-left' : 'slide-right'
}
})
</script>
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"test:runtime": "vitest -c vitest.nuxt.config.ts --coverage",
"test:types": "pnpm --filter './test/fixtures/**' test:types",
"test:unit": "vitest run packages/ --coverage",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"typecheck:docs": "nuxi prepare && nuxt-content-twoslash verify --content-dir docs"
},
"resolutions": {
"@nuxt/kit": "workspace:*",
Expand Down Expand Up @@ -71,6 +72,7 @@
"nitropack": "2.8.1",
"nuxi": "3.10.1",
"nuxt": "workspace:*",
"nuxt-content-twoslash": "^0.0.4",
"ofetch": "1.3.3",
"pathe": "1.1.2",
"playwright-core": "1.41.2",
Expand Down

0 comments on commit 3f882c9

Please sign in to comment.