Skip to content

Commit c224e92

Browse files
authored
chore: add typecheck scripts to 4 examples covered by plan 001 (#65)
1 parent fd8b1c6 commit c224e92

15 files changed

Lines changed: 149 additions & 191 deletions

File tree

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ The `pnpm test` script intentionally runs `build` first so `tsnapi` snapshots co
3131

3232
`pnpm typecheck` fans out through Turbo: every workspace package owns a `"typecheck": "tsc --noEmit"` script and its own `tsconfig.json` (extending `tsconfig.base.json` with an explicit `include`). Cross-package imports resolve to source through the `paths` aliases in `tsconfig.base.json`, so no prior build is needed. Any package added under `packages/*` or `plugins/*` is typechecked automatically once it ships that `typecheck` script — add one to every new package so it can't silently skip type errors.
3333

34+
`pnpm typecheck` runs `scripts/verify-typecheck-coverage.ts` first — it fails the command (and CI, since CI just runs `pnpm typecheck`) if any workspace package has a `tsconfig.json` but no `typecheck` script, so a new package can't silently join the same blind spot. A package that genuinely can't typecheck yet needs a documented exception in that script, not a missing script.
35+
3436
## Conventions
3537

3638
- RPC functions must use `defineRpcFunction`; always namespace IDs (`my-plugin:fn-name`).

‎examples/files-inspector/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"build": "vite build --config src/client/vite.config.ts",
1414
"dev": "node bin.mjs",
1515
"cli:build": "node bin.mjs build --out-dir dist/static",
16-
"test": "vitest run"
16+
"test": "vitest run",
17+
"typecheck": "tsc --noEmit"
1718
},
1819
"dependencies": {
1920
"@antfu/design": "catalog:frontend",

‎examples/minimal-vite-devframe-hub/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"homepage": "https://github.com/devframes/devframe/tree/main/examples/minimal-vite-devframe-hub",
88
"scripts": {
99
"dev": "vite --host",
10-
"build": "vite build"
10+
"build": "vite build",
11+
"typecheck": "tsc --noEmit"
1112
},
1213
"dependencies": {
1314
"@antfu/design": "catalog:frontend",

‎examples/next-runtime-snapshot/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"cli:build": "node bin.mjs build --out-dir dist/static",
1515
"dev": "node bin.mjs",
1616
"next:dev": "next dev src/client",
17-
"test": "vitest run"
17+
"test": "vitest run",
18+
"typecheck": "tsc --noEmit"
1819
},
1920
"dependencies": {
2021
"@antfu/design": "catalog:frontend",

‎examples/next-runtime-snapshot/src/rpc/functions/env.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const env = defineRpcFunction({
4141
total: v.number(),
4242
pattern: v.string(),
4343
}),
44-
handler: ({ pattern, limit }): EnvSnapshot => {
44+
handler: ({ pattern = '', limit = 50 }): EnvSnapshot => {
4545
const keys = Object.keys(process.env).sort()
4646
let matched: string[]
4747
if (!pattern) {

‎examples/streaming-chat/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"build": "vite build --config src/client/vite.config.ts",
1414
"cli:build": "node bin.mjs build --out-dir dist/static",
1515
"dev": "node bin.mjs",
16-
"test": "vitest run"
16+
"test": "vitest run",
17+
"typecheck": "tsc --noEmit"
1718
},
1819
"dependencies": {
1920
"@antfu/design": "catalog:frontend",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Side-effect style imports used by the Preact SPA entry.
2+
declare module '*.css' {}
3+
declare module 'virtual:uno.css' {}

‎examples/streaming-chat/src/rpc/functions/send.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const send = defineRpcFunction({
6161
setup: (ctx) => {
6262
const { channel, history, pruneIfTooLarge } = getStreamingChatContext(ctx)
6363
return {
64-
handler: async ({ prompt, intervalMs = 35 }) => {
64+
handler: ({ prompt, intervalMs = 35 }) => {
6565
const stream = channel.start()
6666
const userId = nanoid()
6767
const assistantId = nanoid()

‎examples/streaming-chat/tests/_utils.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { DevframeNodeContext, StartedServer } from 'devframe/node'
1+
import type { StartedServer } from 'devframe/node'
2+
import type { DevframeNodeContext } from 'devframe/types'
23
import { existsSync } from 'node:fs'
34
import path from 'node:path'
45
import process from 'node:process'

‎examples/streaming-chat/tests/streaming-chat.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { DevframeNodeContext, StartedServer } from 'devframe/node'
1+
import type { StartedServer } from 'devframe/node'
2+
import type { DevframeNodeContext } from 'devframe/types'
23
import type { ChatHistory } from '../src/devframe'
34
import { createRpcStreamingClientHost } from 'devframe/client'
45
import { createRpcClient } from 'devframe/rpc/client'

0 commit comments

Comments
 (0)