You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-14Lines changed: 40 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ The catalog is generated from the packages installed in this repository. It expo
10
10
11
11
- Node.js `^20.19.0` or `>=22.12.0`
12
12
- npm
13
+
- Podman (for containerized browser tests)
13
14
14
15
## Getting Started
15
16
@@ -23,24 +24,40 @@ Vite prints the local development URL, normally <http://localhost:5173/>.
23
24
## Commands
24
25
25
26
```bash
26
-
npm run dev # Generate the catalog and start Vite
27
-
npm run generate # Rebuild the catalog from installed Solid packages
28
-
npm run check # Regenerate and run TypeScript checks
29
-
npm run build # Regenerate and create a production build
30
-
npm run preview # Preview the production build through Vite
31
-
npm start # Serve the build and Demo APIs with the production Node server
32
-
npm run verify:demos # Verify all browser and SSR examples
33
-
npm run format # Format project source files with Prettier
34
-
npm run format:check # Check formatting without writing files
27
+
npm run dev # Generate both catalogs and start Vite
28
+
npm run generate # Rebuild generated catalog artifacts
29
+
npm run check # Regenerate and run TypeScript checks
30
+
npm run build # Regenerate and create a production build
31
+
npm run preview # Preview the production build through Vite
32
+
npm start # Serve the build and Demo APIs with the production Node server
33
+
npm test# Run the complete static, demo, and browser test suite
34
+
npm run test:e2e # Run Playwright with a locally installed browser
35
+
npm run test:e2e:podman # Run Playwright in the pinned browser container
36
+
npm run verify:demos # Verify all browser and SSR examples
37
+
npm run format # Format project source files with Prettier
38
+
npm run format:check # Check formatting without writing files
35
39
```
36
40
37
-
`predev`, `precheck`, and `prebuild` regenerate the API catalog automatically.
41
+
`predev`, `precheck`, and `prebuild` regenerate both API catalog artifacts automatically.
42
+
43
+
## Browser Tests
44
+
45
+
The end-to-end suite uses Playwright and the `mcr.microsoft.com/playwright:v1.62.0-noble` Podman image. The image owns Chromium and its system libraries, so no browser is installed on the host. The suite builds the production app, starts a Vite preview server inside the temporary container, and covers desktop search and browser history, persisted locale and theme preferences, executable demos, the mobile catalog, and the lazy API chunk boundary.
46
+
47
+
```bash
48
+
npm run test:e2e:podman
49
+
```
50
+
51
+
Failures retain screenshots, videos, and Playwright traces under `test-results/`; the HTML report is written to `playwright-report/`. Override the image for an internal registry or mirror with `PLAYWRIGHT_IMAGE` while keeping its Playwright version aligned with `@playwright/test`.
52
+
53
+
GitHub Actions runs type checks, formatting checks, and the same Podman browser suite on pushes and pull requests. See [tests/README.md](tests/README.md) for the test layers, environment overrides, and artifact workflow.
38
54
39
55
## Project Structure
40
56
41
57
```text
42
58
data/
43
-
catalog.json Generated metadata, locale text pools, and demo source pool
59
+
catalog-index.json Lightweight generated navigation and search index
60
+
catalog.json Complete metadata, locale text pools, and demo source pool
44
61
45
62
scripts/
46
63
README.md Catalog and demo tooling documentation
@@ -63,7 +80,8 @@ scripts/
63
80
64
81
src/
65
82
main.tsx Browser entry and application composition
66
-
data/catalog.ts Typed adapter for generated data
83
+
data/catalog-index.ts Eager adapter for lightweight discovery data
84
+
data/catalog.ts Lazy adapter for complete API reference data
67
85
features/api/ API page and reference view
68
86
features/demo/ Controller, view, and runtime adapter
`data` is generated, `scripts/catalog` owns catalog content and generation, `scripts/demo` owns executable demo services, and `src` contains the browser application.
@@ -86,7 +108,7 @@ src/
86
108
3. Has at least one callable TypeScript signature.
87
109
4. Is not marked `@internal`.
88
110
89
-
The generated `data/catalog.json` stores metadata, categories, localized prose, demo source, and compact record indexes. [src/data/catalog.ts](src/data/catalog.ts) validates and expands it for the application. Do not edit or manually format this generated file.
111
+
The generator writes two artifacts. `data/catalog-index.json`contains only the bilingual summaries and identity fields needed by navigation and search. `data/catalog.json`stores complete signatures, related types, localized prose pools, and demo source. [src/data/catalog-index.ts](src/data/catalog-index.ts) loads the index eagerly, while [src/data/catalog.ts](src/data/catalog.ts) validates and expands the complete catalog only when an API page is opened. Do not edit or manually format either generated file.
90
112
91
113
English and Chinese API prose is resolved by `scripts/catalog/locale-en.mjs` and `scripts/catalog/locale-zh-cn.mjs`. Each strategy contains the current API content and a resolver for APIs discovered in later package versions. Every API has its own language-neutral, complete demo program in `scripts/catalog/demos.mjs`.
92
114
@@ -130,9 +152,11 @@ Current verified surface:
130
152
131
153
## Frontend Architecture
132
154
133
-
The application is a Solid single-page interface with hash-based API selection. It does not use a router or external state manager. A single optional active-document ID represents both home and API routes, avoiding duplicated route state.
155
+
The application is a Solid single-page interface with hash-based API selection. It does not use a router or external state manager. A single optional active-document ID represents both home and API routes, while a small history adapter keeps deep links and browser back/forward navigation synchronized.
134
156
157
+
- Navigation and search use a lightweight generated index; complete reference data and the API feature load on demand.
135
158
- Demo execution stays in the feature controller; inline and fullscreen editors share one implementation.
159
+
- The browser runtime is dynamically imported only when an example executes; result types and SSR classification live in a dependency-light model.
136
160
- Tailwind CSS v4 provides the CSS-first design system and utility styles.
137
161
- Prism provides TypeScript/TSX highlighting.
138
162
- Lucide provides interface icons.
@@ -146,6 +170,8 @@ The application is a Solid single-page interface with hash-based API selection.
146
170
147
171
Detailed maintenance documentation:
148
172
173
+
-[Deployment and code packaging](./DEPLOYMENT.md)
149
174
-[Release changes](./CHANGELOG.md)
150
175
-[Catalog and demo tooling](./scripts/README.md)
176
+
-[Testing and browser automation](./tests/README.md)
生成器会写入两个产物。`data/catalog-index.json` 只包含导航和搜索所需的双语摘要与标识字段;`data/catalog.json`保存完整签名、关联类型、本地化文本池和示例源码。[src/data/catalog-index.ts](src/data/catalog-index.ts)在首屏加载轻量索引,[src/data/catalog.ts](src/data/catalog.ts) 仅在打开 API 页面时验证并展开完整目录。不要编辑或手动格式化这两个生成文件。
90
112
91
113
中英文 API 内容分别由 `scripts/catalog/locale-en.mjs` 和 `scripts/catalog/locale-zh-cn.mjs` 解析。每种策略包含当前 API 内容,以及用于处理未来新增 API 的回退解析器。每个 API 都在 `scripts/catalog/demos.mjs` 中拥有独立、完整且与语言无关的示例程序。
92
114
@@ -130,9 +152,11 @@ SSR 示例为只读,只执行可信的生成源码。源码和请求正文上
130
152
131
153
## 前端架构
132
154
133
-
应用是使用 Hash 选择 API 的 Solid 单页界面,不依赖路由器或外部状态管理器。首页和 API 页面由单一的可选当前文档 ID 表达,避免维护重复路由状态。
155
+
应用是使用 Hash 选择 API 的 Solid 单页界面,不依赖路由器或外部状态管理器。首页和 API 页面由单一的可选当前文档 ID 表达,小型历史适配层负责同步深链接和浏览器前进、后退行为。
0 commit comments