@svadmin/create 0.18.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,6 +36,32 @@ bun install
36
36
  bun run dev
37
37
  ```
38
38
 
39
+ ## Automated Inference CLI / 接口代码推断器
40
+
41
+ Automatically infer ResourceDefinitions, TypeBox schemas, and Svelte 5 CRUD components from REST endpoints, OpenAPI / Swagger specs, GraphQL endpoints (introspection), or local schema/sample files:
42
+
43
+ 根据 REST 接口、OpenAPI 规范、GraphQL 端点或本地样本数据自动推导资源定义、TypeBox Schema 及 Svelte 5 完整 CRUD 页面:
44
+
45
+ ```bash
46
+ # Infer from OpenAPI JSON spec URL
47
+ npx @svadmin/create infer --url https://api.example.com/openapi.json --out-dir src/resources --write
48
+
49
+ # Infer from GraphQL endpoint (automatic introspection)
50
+ npx @svadmin/create infer --url https://api.example.com/graphql --out-dir src/resources --write
51
+
52
+ # Infer from REST sample data endpoint
53
+ npx @svadmin/create infer --url https://api.example.com/api/v1/posts --resource posts --out-dir src/resources --write
54
+
55
+ # Infer from local GraphQL SDL or OpenAPI file
56
+ npx @svadmin/create infer --file schema.graphql --out-dir src/resources --write
57
+ ```
58
+
59
+ Generated artifacts include:
60
+ - `<resource>.resource.ts`: ResourceDefinition with field types, relations, and CRUD capabilities
61
+ - `<resource>.schema.ts`: Sinclair TypeBox schema and static TypeScript types
62
+ - `<resource>/ListPage.svelte`, `<resource>/CreatePage.svelte`, `<resource>/EditPage.svelte`, `<resource>/ShowPage.svelte`: Svelte 5 page components
63
+ - `index.ts`: Barrel export file
64
+
39
65
  ## Eject Components / 组件弹出
40
66
 
41
67
  Extract internal `@svadmin/ui` components into your project for deep customization:
@@ -108,3 +134,22 @@ overwriting local standards:
108
134
  bunx @svadmin/create guidance .
109
135
  bunx @svadmin/create guidance . --write
110
136
  ```
137
+
138
+ ## Add Lite routes to an existing SPA
139
+
140
+ Lite is an optional SvelteKit server-rendered route tree. It does not modify the
141
+ existing SPA or add IE11 branches to the SPA bundle. In a project that already
142
+ has a SvelteKit `src/routes` directory, run:
143
+
144
+ ```bash
145
+ # Preview the files first; nothing is written
146
+ bunx @svadmin/create lite init .
147
+
148
+ # Generate the shared adapter and dynamic CRUD routes
149
+ bunx @svadmin/create lite init . --write
150
+ ```
151
+
152
+ The generator creates one `[resource]` route for all resources plus the shared
153
+ `src/lib/svadmin-lite.ts` adapter. Your existing `$lib/admin` module only needs
154
+ to export `resources` and `dataProvider`; resources are resolved dynamically at
155
+ request time. Existing files are preserved, so rerunning the command is safe.