From 20104a6d536d7a7a83be5ff88cf769fe1a914dbb Mon Sep 17 00:00:00 2001 From: imbytecat Date: Sat, 25 Apr 2026 13:37:05 +0800 Subject: [PATCH] =?UTF-8?q?docs(readme):=20=E8=A1=A5=20test=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E4=B8=8E=20query=20helper=20=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - scripts 表加 `bun run test` - Add a feature 拆出 `src/client/queries/.ts` 步骤,与 AGENTS.md 对齐 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0983b48..f02e2c0 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ RPC endpoint: `/api/rpc` · OpenAPI docs: `/api/docs` · Spec: `/api/spec.json` | `bun run compile` | Single-binary `out/server-` via `bun build --compile` | | `bun run cli ` | Run a CLI subcommand in source (`serve`, `migrate`) | | `bun run typecheck` | `tsc --noEmit` | +| `bun run test` | `bun test` (colocated `*.test.ts`) | | `bun run fix` | Biome lint + format + organize imports | | `bun run db:push` | Dev-only schema sync (no migration files) | | `bun run db:generate` | Write SQL migrations to `./drizzle` | @@ -42,8 +43,9 @@ Contract-first, additive. Create or touch files in this order: 4. `src/server/api/contracts/index.ts` — add `post` to the `contract` object. 5. `src/server/api/routers/post.router.ts` — implement `os.post.*.handler(...)`. 6. `src/server/api/routers/index.ts` — add `post` to the `router` object. -7. `src/routes/.tsx` — UI with `useSuspenseQuery` + loader `ensureQueryData`; invalidate affected list queries in mutation `onSuccess` handlers. -8. `bun run db:generate` — emit SQL migrations to `./drizzle`. +7. `src/client/queries/post.ts` — export `useInvalidatePosts` (or finer-grained helpers) for affected list keys. +8. `src/routes/.tsx` — UI with `useSuspenseQuery` + loader `ensureQueryData`; call the helper from mutation `onSuccess`. +9. `bun run db:generate` — emit SQL migrations to `./drizzle`. ## Deploy