From dd4a6be361ac4fb44972939daf0f1fe0b3f4fdc4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 6 Aug 2026 10:04:37 +0000 Subject: [PATCH] =?UTF-8?q?docs(readme):=20=E7=94=A8=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E7=9A=84=20examples=20=E7=9B=AE=E5=BD=95=E6=9B=BF=E6=8D=A2=204?= =?UTF-8?q?=20=E4=B8=AA=E5=B7=B2=E5=88=A0=E9=99=A4=E7=9A=84=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E6=9D=A1=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit README.md:59-62 推荐了 examples/crm、todo、kitchen-sink、msw-todo 四个目录, 它们都不存在。git 历史确认这是「被删」而非「移仓」或「计划未建」:四个目录 (@object-ui/example-{crm,todo,kitchen-sink,msw-todo})在同一个提交 12b287d8b "refactor: remove example Todo application and related files"(2026-05-02)中 被整体删除,该提交没有新增任何目录,也没有触碰 README.md —— 这就是漂移的来源。 - 删掉四条幽灵条目,补上真实存在但一直没被提及的 hello-world 与 schema-catalog, 描述取自它们各自的 README/package.json,未作臆测。 - "Running Examples as API Servers" 整节已经完全失效:根 package.json 没有任何 serve:* 脚本,现存四个示例也都没有 serve 脚本,且该节点名的三个示例均已删除。 替换为真实可用的 Vite dev 流程。 - examples/README.md 表格漏了 schema-catalog,补上;它自称"不是可运行应用", 因此单列一节而非塞进 Runnable 表格。同时修正对 hello-world 不成立的 `cd examples/ && pnpm dev` 通用说明。 Fixes #3480 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt --- README.md | 31 +++++++++++++------------------ examples/README.md | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 2139395e9f..33daa0a7f9 100644 --- a/README.md +++ b/README.md @@ -54,34 +54,29 @@ One schema, many view types — dashboards, Gantt schedules, kanban boards, cale ## Examples -ObjectStack examples that demonstrate different features and use cases: +Everything under [`examples/`](examples) — in learning order. The +[examples catalog](examples/README.md) has the full "which one should I use?" table. -- **[examples/crm](examples/crm)** - Full-featured CRM application with dashboards, multiple views (Grid, Kanban, Map, Gantt), and custom server implementation. -- **[examples/todo](examples/todo)** - Simple task management app demonstrating basic ObjectStack configuration and field types. -- **[examples/kitchen-sink](examples/kitchen-sink)** - Comprehensive component catalog showing all available field types, dashboard widgets, and view types. -- **[examples/msw-todo](examples/msw-todo)** - Frontend-first development example using MSW (Mock Service Worker) to run ObjectStack in the browser. +- **[examples/hello-world](examples/hello-world)** - The smallest JSON → UI demo: one `schema.json` (a `Page` holding a `Card` with text and a button) rendered by `` from a single `App.tsx`. Start here to see how a `type` resolves against the component registry. - **[examples/byo-backend-console](examples/byo-backend-console)** ⭐ - Minimal custom console in ~100 lines showing third-party integration without full console infrastructure. Uses `@object-ui/app-shell` and `@object-ui/providers` with custom routing and a mock REST adapter (BYO backend). - **[examples/console-starter](examples/console-starter)** - Opinionated, fork-ready console template with the full plugin set (grid, kanban, dashboard, designer, charts, …) wired up against an ObjectStack backend. Use this as the starting point when you want a complete console rather than a minimal integration. +- **[examples/schema-catalog](examples/schema-catalog)** - Not a runnable app — the canonical JSON schema catalog that is the single source of truth for the schemas shipped elsewhere: the docs site renders them via ``, a smoke test mounts every entry, and AI agents use it as a few-shot corpus. -### Running Examples as API Servers - -All examples (except msw-todo) can be run as API servers using `@objectstack/cli`: +### Running an example ```bash # From the monorepo root -pnpm run serve:crm # Start CRM example on http://localhost:3000 -pnpm run serve:todo # Start Todo example on http://localhost:3000 -pnpm run serve:kitchen-sink # Start Kitchen Sink example on http://localhost:3000 +pnpm install +pnpm -w build -# Or from individual example directories -cd examples/crm -pnpm run serve +# Vite dev server — byo-backend-console or console-starter +cd examples/console-starter +pnpm dev ``` -Each server provides: -- GraphQL API endpoint: `http://localhost:3000/graphql` -- REST API endpoints based on object definitions -- Sample data loaded from the configuration manifest +`hello-world` ships no dev server: copy its `App.tsx` and `schema.json` into your own +Vite/Next.js app. `schema-catalog` is a data package — its smoke test mounts every +schema in it (`pnpm --filter @object-ui/example-schema-catalog test`). ## 📦 For React Developers diff --git a/examples/README.md b/examples/README.md index 3012e38154..6b7f5648e7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -15,18 +15,28 @@ Runnable examples that show how to consume ObjectUI in different scenarios. Pick > - Adding ObjectUI to an existing product / different backend → `byo-backend-console`. > - Standing up a brand-new ObjectStack console → fork `console-starter`. +### Also under `examples/` + +| Directory | What it is | +|---|---| +| [`schema-catalog/`](./schema-catalog) | **Not a runnable app** — a data package (`@object-ui/example-schema-catalog`) holding the canonical JSON schemas consumed by the docs site (``), by the smoke test that mounts every entry, and by AI agents as a few-shot corpus. See [its README](./schema-catalog/README.md) for how to add one. | + ## Running an example -From the monorepo root: +`byo-backend-console` and `console-starter` are Vite apps. From the monorepo root: ```bash pnpm install pnpm -w build -cd examples/ +cd examples/console-starter # or byo-backend-console pnpm dev ``` -Each example exposes its own dev server port (see its README). +Each exposes its own dev server port (see its README). + +The other two directories are not dev servers: `hello-world` is a snippet to drop into +your own Vite/Next.js app, and `schema-catalog` is a data package verified with +`pnpm --filter @object-ui/example-schema-catalog test`. ## Adding a new example