@svadmin/create 0.31.0 → 0.32.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 +88 -0
- package/dist/index.js +1128 -124
- package/guidance/AGENTS.md +20 -0
- package/package.json +2 -2
- package/scaffold-manifest.json +115 -6
- package/template/src/App.svelte +15 -18
package/README.md
CHANGED
|
@@ -17,6 +17,42 @@ Follow the interactive prompts to:
|
|
|
17
17
|
2. Choose a default Data Provider (Simple REST, Supabase, GraphQL, or Custom).
|
|
18
18
|
3. Choose an Auth Provider (Mock, JWT, Supabase, or None).
|
|
19
19
|
|
|
20
|
+
### Golden-path presets
|
|
21
|
+
|
|
22
|
+
Skip the prompts with a curated preset:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @svadmin/create init my-admin-app --preset supabase
|
|
26
|
+
npx @svadmin/create init my-admin-app --preset rest
|
|
27
|
+
npx @svadmin/create init my-admin-app --preset graphql
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Preset | Data provider | Auth provider |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `supabase` | Supabase | Supabase Auth |
|
|
33
|
+
| `rest` | Simple REST | REST JWT |
|
|
34
|
+
| `graphql` | GraphQL | Mock (demo) |
|
|
35
|
+
|
|
36
|
+
Override any field explicitly: `--data-provider graphql --auth-provider none`, and
|
|
37
|
+
skip install with `--no-install`. Explicit flags always win over the preset.
|
|
38
|
+
|
|
39
|
+
The `init` prompt and presets stay on the golden paths. To add any of the other
|
|
40
|
+
official providers later, use the CLI catalog (also published in
|
|
41
|
+
`svadmin.ai.json` → `providerCatalog`):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx @svadmin/create add provider pocketbase --write
|
|
45
|
+
npx @svadmin/create add provider hasura --write
|
|
46
|
+
npx @svadmin/create add provider appwrite --write
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Official data providers: `simple-rest`, `supabase`, `graphql`, `rest`, `airtable`,
|
|
50
|
+
`appwrite`, `directus`, `drizzle`, `elysia`, `firebase`, `hasura`, `medusa`,
|
|
51
|
+
`nestjs-query`, `nestjsx-crud`, `pocketbase`, `sanity`, `strapi`. `add provider`
|
|
52
|
+
updates `package.json` + `svadmin.ai.json` and prints the remaining
|
|
53
|
+
`src/svadmin.config.ts` wiring step; the generated config leaves a clearly marked
|
|
54
|
+
TODO placeholder for non-golden providers.
|
|
55
|
+
|
|
20
56
|
## What's Included
|
|
21
57
|
|
|
22
58
|
The generated project is pre-configured with:
|
|
@@ -27,6 +63,52 @@ The generated project is pre-configured with:
|
|
|
27
63
|
- **@svadmin/ui**: Beautiful default dashboard UI, standalone CRUD buttons, and data tables.
|
|
28
64
|
- Pre-wired **TanStack Query** for client-state management.
|
|
29
65
|
|
|
66
|
+
### Platform entrypoints
|
|
67
|
+
|
|
68
|
+
Two stable files are generated for humans and AI tooling:
|
|
69
|
+
|
|
70
|
+
- `src/svadmin.config.ts` — the application entrypoint. It composes the selected
|
|
71
|
+
data/auth providers into one `defineAdminConfig(...)` bundle and exports the
|
|
72
|
+
resource registry. Async providers are resolved with top-level await, so the
|
|
73
|
+
exported config is always a fully-resolved static bundle.
|
|
74
|
+
- `svadmin.ai.json` — the machine-readable manifest: provider capability matrix,
|
|
75
|
+
resource fields and operations, project commands, and forbidden internal imports.
|
|
76
|
+
|
|
77
|
+
`src/App.svelte` consumes the config through `resolveAdminConfig(config)` and passes
|
|
78
|
+
`providerBundle` + `resources` to `AdminApp`.
|
|
79
|
+
|
|
80
|
+
- `svadmin.schema.json` — JSON Schema (draft 2020-12) describing `svadmin.ai.json`.
|
|
81
|
+
Editors and AI tools can validate the manifest against it.
|
|
82
|
+
|
|
83
|
+
`create-svadmin doctor` validates the manifest when it exists: it must be valid
|
|
84
|
+
JSON with `version: 1`, its provider packages must be present in `package.json`,
|
|
85
|
+
and `svadmin.schema.json` must sit beside it. Legacy projects without
|
|
86
|
+
`src/svadmin.config.ts` are unaffected.
|
|
87
|
+
|
|
88
|
+
## Add Platform Pieces / 追加平台能力
|
|
89
|
+
|
|
90
|
+
Add a business feature module or a provider dependency pack without rewriting the
|
|
91
|
+
project. Every command is idempotent, dry-run by default, and preserves existing
|
|
92
|
+
files; pass `--write` to apply.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Scaffold src/features/orders/{index.ts,orders.resource.ts}
|
|
96
|
+
npx @svadmin/create add resource orders --write
|
|
97
|
+
|
|
98
|
+
# Add the Supabase data provider dependency pack
|
|
99
|
+
npx @svadmin/create add provider supabase --write
|
|
100
|
+
|
|
101
|
+
# Add the JWT auth dependency pack
|
|
102
|
+
npx @svadmin/create add auth jwt --write
|
|
103
|
+
|
|
104
|
+
# Target a project directory other than the current one
|
|
105
|
+
npx @svadmin/create add resource orders --project-dir ./my-admin-app --write
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`add provider` / `add auth` update `package.json` and `svadmin.ai.json` and print
|
|
109
|
+
the remaining step: wire the provider in `src/svadmin.config.ts`. `add resource`
|
|
110
|
+
creates the module and prints the `src/resources.ts` registration snippet.
|
|
111
|
+
|
|
30
112
|
## Start Developing
|
|
31
113
|
|
|
32
114
|
Once scaffolded, `cd` into your directory, install dependencies, and start the development server:
|
|
@@ -115,6 +197,12 @@ Apply the plan explicitly. The CLI creates a timestamped `package.json.svadmin-b
|
|
|
115
197
|
npx @svadmin/create upgrade --write
|
|
116
198
|
```
|
|
117
199
|
|
|
200
|
+
`migrate` is an alias for `upgrade` and runs the same dependency-migration plan:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npx @svadmin/create migrate --write
|
|
204
|
+
```
|
|
205
|
+
|
|
118
206
|
Both commands accept an optional project-directory argument. Upgrade only manages dependencies known by the shipped scaffold; custom dependencies, scripts, and other package fields are preserved.
|
|
119
207
|
|
|
120
208
|
## Development
|