@svgrid/studio 0.8.0 → 0.8.2
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/LICENSE +10 -3
- package/README.md +126 -123
- package/dist/cli.js +83 -71
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -26,9 +26,16 @@ a non-exclusive, non-transferable, non-sublicensable license to:
|
|
|
26
26
|
that all copyright notices and license terms are preserved.
|
|
27
27
|
|
|
28
28
|
The number of developer seats covered is determined by the
|
|
29
|
-
Subscriber's SvGrid
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
Subscriber's SvGrid Enterprise order, and the Software is covered by
|
|
30
|
+
the Suite Developer License edition of that order. A Grid Developer
|
|
31
|
+
License does not cover the Software. A "developer" is any individual
|
|
32
|
+
who runs the Software, or who writes or modifies source code it
|
|
33
|
+
generated.
|
|
34
|
+
|
|
35
|
+
Section 1A of the `@svgrid/enterprise` license applies to the Software
|
|
36
|
+
as well: shipping it, or what it generates, to third parties as a
|
|
37
|
+
component, an SDK, or an application builder they build with needs an
|
|
38
|
+
OEM License.
|
|
32
39
|
|
|
33
40
|
Code generated by the Software is owned by the Subscriber and is not
|
|
34
41
|
subject to Section 2, except that generated code which imports
|
package/README.md
CHANGED
|
@@ -1,123 +1,126 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="https://svgrid.com/brand/svgrid-logo-icon-1200.png" alt="SvGrid" width="100" height="100" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">@svgrid/studio</h1>
|
|
6
|
-
|
|
7
|
-
<p align="center"><strong>Generate SvelteKit CRUD screens from your database schema.</strong></p>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
<a href="https://www.npmjs.com/package/@svgrid/studio"><img src="https://img.shields.io/npm/v/%40svgrid%2Fstudio.svg?label=%40svgrid%2Fstudio" alt="npm version" /></a>
|
|
11
|
-
<a href="https://svgrid.com/pricing/"><img src="https://img.shields.io/badge/license-commercial-blue.svg" alt="Commercial license" /></a>
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
<p align="center">
|
|
15
|
-
<a href="https://svgrid.com">Website</a> ·
|
|
16
|
-
<a href="https://svgrid.com/docs/">Docs</a> ·
|
|
17
|
-
<a href="https://svgrid.com/pricing/">Pricing</a>
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
Not sure where to start? Let it ask:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npx @svgrid/studio init
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
`init` walks you through it - where your data lives, which tables you want,
|
|
29
|
-
which pages each gets - and writes a runnable SvelteKit app: a searchable list,
|
|
30
|
-
an edit form and a record page per table, plus an overview dashboard. Point it
|
|
31
|
-
straight at a database and it installs the driver for you:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx @svgrid/studio init --db postgres --url "$DATABASE_URL" --out my-app
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Or scaffold a single CRUD screen into an existing app from a **live database**
|
|
38
|
-
or a **Drizzle / Prisma schema** in **one command**:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# from a live database (PostgreSQL / Supabase / MySQL / SQL Server / SQLite)
|
|
42
|
-
npx @svgrid/studio add customers --db postgres --url "$DATABASE_URL"
|
|
43
|
-
|
|
44
|
-
# or from a schema file - a Drizzle schema.ts or a Prisma schema.prisma
|
|
45
|
-
npx @svgrid/studio add customers --from src/lib/db/schema.ts
|
|
46
|
-
npx @svgrid/studio add User --from prisma/schema.prisma
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
That generates, into your SvelteKit app:
|
|
50
|
-
|
|
51
|
-
- `src/lib/customers.schema.ts` - the entity schema + row type
|
|
52
|
-
- `src/routes/api/customers/+server.ts` - the API route
|
|
53
|
-
- `src/routes/customers/+page.svelte` - a working screen: grid + edit panel, with
|
|
54
|
-
search, server sort, pagination, and multi-select (optimistic) delete
|
|
55
|
-
|
|
56
|
-
Then:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm run dev # open /customers
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Connect to a database
|
|
63
|
-
|
|
64
|
-
Install the driver for your database, then point `--db` / `--url` at it. The CLI
|
|
65
|
-
reads the table's columns from the catalog and wires the generated route to that
|
|
66
|
-
driver. No driver is bundled.
|
|
67
|
-
|
|
68
|
-
| Database | Install | Flag |
|
|
69
|
-
| --- | --- | --- |
|
|
70
|
-
| PostgreSQL | `pg` | `--db postgres` |
|
|
71
|
-
| Supabase | `pg` | `--db supabase` |
|
|
72
|
-
| MySQL / MariaDB | `mysql2` | `--db mysql` |
|
|
73
|
-
| SQL Server | `mssql` | `--db mssql` |
|
|
74
|
-
| SQLite | `better-sqlite3` | `--db sqlite` |
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
npm i pg
|
|
78
|
-
npx @svgrid/studio add --all --db postgres --url "$DATABASE_URL" # every table
|
|
79
|
-
npx @svgrid/studio add todos --db sqlite --url ./data.db # one table
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Scaffold the whole app from your schema
|
|
83
|
-
|
|
84
|
-
`--all --from` reads **every** table/model in a schema file and generates a
|
|
85
|
-
screen for each, plus a nav layout and home page. Foreign keys are followed
|
|
86
|
-
across the file - a Drizzle `.references()` or a Prisma `@relation` becomes a
|
|
87
|
-
searchable lookup, and enums become select fields:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npx @svgrid/studio add --all --from src/lib/db/schema.ts # every Drizzle table
|
|
91
|
-
npx @svgrid/studio add --all --from prisma/schema.prisma # every Prisma model
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Options
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
svgrid-studio add <name> [--from <schema> | --db <dialect> --url <conn>] [options]
|
|
98
|
-
|
|
99
|
-
--from <path> Drizzle (.ts) or Prisma (.prisma) schema file to introspect
|
|
100
|
-
--db <dialect> Connect to a live database (postgres|supabase|mysql|mssql|sqlite)
|
|
101
|
-
--url <conn> Connection string / file path for --db
|
|
102
|
-
--all Scaffold a screen for every table/model (with --from or --db)
|
|
103
|
-
--table <name> Which table/model to use (defaults to <name>)
|
|
104
|
-
--sql Use createSqlDataSource with an execute() stub (instead of a driver)
|
|
105
|
-
--route <seg> Route segment (default: <name> / table name)
|
|
106
|
-
--api <path> API route path (default: /api/<route>)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
With `--db`, the generated route is fully connected to that driver via
|
|
110
|
-
`process.env.DATABASE_URL`. With `--from` (no `--db`) it starts in-memory so the
|
|
111
|
-
screen runs immediately; add `--sql` for a `createSqlDataSource` stub you fill
|
|
112
|
-
in with any client (Drizzle `db.execute`, postgres.js, better-sqlite3, mysql2).
|
|
113
|
-
|
|
114
|
-
## Regeneration is safe
|
|
115
|
-
|
|
116
|
-
Re-running `add` replaces only the `svgrid:managed` regions of each file - your
|
|
117
|
-
edits outside those markers are preserved.
|
|
118
|
-
|
|
119
|
-
## Requires
|
|
120
|
-
|
|
121
|
-
`@svgrid/grid` and `@svgrid/enterprise` in your project. The Studio is part of the
|
|
122
|
-
**
|
|
123
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://svgrid.com/brand/svgrid-logo-icon-1200.png" alt="SvGrid" width="100" height="100" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@svgrid/studio</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><strong>Generate SvelteKit CRUD screens from your database schema.</strong></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/@svgrid/studio"><img src="https://img.shields.io/npm/v/%40svgrid%2Fstudio.svg?label=%40svgrid%2Fstudio" alt="npm version" /></a>
|
|
11
|
+
<a href="https://svgrid.com/pricing/"><img src="https://img.shields.io/badge/license-commercial-blue.svg" alt="Commercial license" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://svgrid.com">Website</a> ·
|
|
16
|
+
<a href="https://svgrid.com/docs/">Docs</a> ·
|
|
17
|
+
<a href="https://svgrid.com/pricing/">Pricing</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
Not sure where to start? Let it ask:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @svgrid/studio init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`init` walks you through it - where your data lives, which tables you want,
|
|
29
|
+
which pages each gets - and writes a runnable SvelteKit app: a searchable list,
|
|
30
|
+
an edit form and a record page per table, plus an overview dashboard. Point it
|
|
31
|
+
straight at a database and it installs the driver for you:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @svgrid/studio init --db postgres --url "$DATABASE_URL" --out my-app
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or scaffold a single CRUD screen into an existing app from a **live database**
|
|
38
|
+
or a **Drizzle / Prisma schema** in **one command**:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# from a live database (PostgreSQL / Supabase / MySQL / SQL Server / SQLite)
|
|
42
|
+
npx @svgrid/studio add customers --db postgres --url "$DATABASE_URL"
|
|
43
|
+
|
|
44
|
+
# or from a schema file - a Drizzle schema.ts or a Prisma schema.prisma
|
|
45
|
+
npx @svgrid/studio add customers --from src/lib/db/schema.ts
|
|
46
|
+
npx @svgrid/studio add User --from prisma/schema.prisma
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
That generates, into your SvelteKit app:
|
|
50
|
+
|
|
51
|
+
- `src/lib/customers.schema.ts` - the entity schema + row type
|
|
52
|
+
- `src/routes/api/customers/+server.ts` - the API route
|
|
53
|
+
- `src/routes/customers/+page.svelte` - a working screen: grid + edit panel, with
|
|
54
|
+
search, server sort, pagination, and multi-select (optimistic) delete
|
|
55
|
+
|
|
56
|
+
Then:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm run dev # open /customers
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Connect to a database
|
|
63
|
+
|
|
64
|
+
Install the driver for your database, then point `--db` / `--url` at it. The CLI
|
|
65
|
+
reads the table's columns from the catalog and wires the generated route to that
|
|
66
|
+
driver. No driver is bundled.
|
|
67
|
+
|
|
68
|
+
| Database | Install | Flag |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| PostgreSQL | `pg` | `--db postgres` |
|
|
71
|
+
| Supabase | `pg` | `--db supabase` |
|
|
72
|
+
| MySQL / MariaDB | `mysql2` | `--db mysql` |
|
|
73
|
+
| SQL Server | `mssql` | `--db mssql` |
|
|
74
|
+
| SQLite | `better-sqlite3` | `--db sqlite` |
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm i pg
|
|
78
|
+
npx @svgrid/studio add --all --db postgres --url "$DATABASE_URL" # every table
|
|
79
|
+
npx @svgrid/studio add todos --db sqlite --url ./data.db # one table
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Scaffold the whole app from your schema
|
|
83
|
+
|
|
84
|
+
`--all --from` reads **every** table/model in a schema file and generates a
|
|
85
|
+
screen for each, plus a nav layout and home page. Foreign keys are followed
|
|
86
|
+
across the file - a Drizzle `.references()` or a Prisma `@relation` becomes a
|
|
87
|
+
searchable lookup, and enums become select fields:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx @svgrid/studio add --all --from src/lib/db/schema.ts # every Drizzle table
|
|
91
|
+
npx @svgrid/studio add --all --from prisma/schema.prisma # every Prisma model
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Options
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
svgrid-studio add <name> [--from <schema> | --db <dialect> --url <conn>] [options]
|
|
98
|
+
|
|
99
|
+
--from <path> Drizzle (.ts) or Prisma (.prisma) schema file to introspect
|
|
100
|
+
--db <dialect> Connect to a live database (postgres|supabase|mysql|mssql|sqlite)
|
|
101
|
+
--url <conn> Connection string / file path for --db
|
|
102
|
+
--all Scaffold a screen for every table/model (with --from or --db)
|
|
103
|
+
--table <name> Which table/model to use (defaults to <name>)
|
|
104
|
+
--sql Use createSqlDataSource with an execute() stub (instead of a driver)
|
|
105
|
+
--route <seg> Route segment (default: <name> / table name)
|
|
106
|
+
--api <path> API route path (default: /api/<route>)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
With `--db`, the generated route is fully connected to that driver via
|
|
110
|
+
`process.env.DATABASE_URL`. With `--from` (no `--db`) it starts in-memory so the
|
|
111
|
+
screen runs immediately; add `--sql` for a `createSqlDataSource` stub you fill
|
|
112
|
+
in with any client (Drizzle `db.execute`, postgres.js, better-sqlite3, mysql2).
|
|
113
|
+
|
|
114
|
+
## Regeneration is safe
|
|
115
|
+
|
|
116
|
+
Re-running `add` replaces only the `svgrid:managed` regions of each file - your
|
|
117
|
+
edits outside those markers are preserved.
|
|
118
|
+
|
|
119
|
+
## Requires
|
|
120
|
+
|
|
121
|
+
`@svgrid/grid` and `@svgrid/enterprise` in your project. The Studio is part of the
|
|
122
|
+
**Suite** edition of the Enterprise license; a Grid-edition key does not cover it.
|
|
123
|
+
|
|
124
|
+
The gate is soft either way: it works unlicensed, and under a Grid key, with a
|
|
125
|
+
watermark and a one-time console notice. Nothing is disabled, so you can build a
|
|
126
|
+
whole app with it before buying. See [licensing](https://svgrid.com/pricing/).
|
package/dist/cli.js
CHANGED
|
@@ -99,6 +99,12 @@ function parse(args) {
|
|
|
99
99
|
out.theme = value(a);
|
|
100
100
|
else if (a === '--dark')
|
|
101
101
|
out.dark = true;
|
|
102
|
+
else if (a === '--kit') {
|
|
103
|
+
const k = Number(value(a));
|
|
104
|
+
if (k !== 2 && k !== 3)
|
|
105
|
+
throw new Error(`--kit must be 2 or 3, got ${k}`);
|
|
106
|
+
out.kit = k;
|
|
107
|
+
}
|
|
102
108
|
else if (a === '--title')
|
|
103
109
|
out.title = value(a);
|
|
104
110
|
else if (a === '-f' || a === '--force')
|
|
@@ -139,75 +145,79 @@ function templateIds(width = 62) {
|
|
|
139
145
|
lines.push(line);
|
|
140
146
|
return lines.join('\n ');
|
|
141
147
|
}
|
|
142
|
-
const HELP = `svgrid-studio - scaffold CRUD screens from a schema file or a live database
|
|
143
|
-
|
|
144
|
-
Usage:
|
|
145
|
-
svgrid-studio init # guided: pick your data, get a working CRUD app
|
|
146
|
-
svgrid-studio designer # open the visual designer in your browser
|
|
147
|
-
svgrid-studio add <name> --from <schema> # one table/model from a schema file
|
|
148
|
-
svgrid-studio add --all --from <schema> # every table/model, linked
|
|
149
|
-
svgrid-studio add <name> --db <dialect> --url <conn> # one table from a live database
|
|
150
|
-
svgrid-studio add --all --db <dialect> --url <conn> # every table from a live database
|
|
151
|
-
svgrid-studio openapi <file|url> # import an OpenAPI (JSON) spec -> studio.config.json
|
|
152
|
-
svgrid-studio eject [--fragment] # write the app (or a drop-in fragment) from studio.config.json
|
|
153
|
-
svgrid-studio dev # designer + the RUNNING app, side by side (HMR)
|
|
154
|
-
svgrid-studio deploy [--target <provider>] [--dry-run] # build + deploy via the provider CLI
|
|
155
|
-
|
|
156
|
-
Guided setup (init) - asks where your data lives, which tables you want, and
|
|
157
|
-
which pages each gets, then writes a runnable app + studio.config.json.
|
|
158
|
-
Running \`svgrid-studio\` with no arguments starts it too.
|
|
159
|
-
--db <dialect> --url <conn> skip the questions and read a live database
|
|
160
|
-
--
|
|
161
|
-
|
|
162
|
-
--
|
|
163
|
-
|
|
164
|
-
--
|
|
165
|
-
|
|
166
|
-
--
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
--
|
|
179
|
-
|
|
180
|
-
--
|
|
181
|
-
--
|
|
182
|
-
--
|
|
183
|
-
--
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
--
|
|
195
|
-
--
|
|
196
|
-
--
|
|
197
|
-
--
|
|
198
|
-
--
|
|
199
|
-
--
|
|
200
|
-
--
|
|
201
|
-
--
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
svgrid-studio
|
|
210
|
-
svgrid-studio
|
|
148
|
+
const HELP = `svgrid-studio - scaffold CRUD screens from a schema file or a live database
|
|
149
|
+
|
|
150
|
+
Usage:
|
|
151
|
+
svgrid-studio init # guided: pick your data, get a working CRUD app
|
|
152
|
+
svgrid-studio designer # open the visual designer in your browser
|
|
153
|
+
svgrid-studio add <name> --from <schema> # one table/model from a schema file
|
|
154
|
+
svgrid-studio add --all --from <schema> # every table/model, linked
|
|
155
|
+
svgrid-studio add <name> --db <dialect> --url <conn> # one table from a live database
|
|
156
|
+
svgrid-studio add --all --db <dialect> --url <conn> # every table from a live database
|
|
157
|
+
svgrid-studio openapi <file|url> # import an OpenAPI (JSON) spec -> studio.config.json
|
|
158
|
+
svgrid-studio eject [--fragment] # write the app (or a drop-in fragment) from studio.config.json
|
|
159
|
+
svgrid-studio dev # designer + the RUNNING app, side by side (HMR)
|
|
160
|
+
svgrid-studio deploy [--target <provider>] [--dry-run] # build + deploy via the provider CLI
|
|
161
|
+
|
|
162
|
+
Guided setup (init) - asks where your data lives, which tables you want, and
|
|
163
|
+
which pages each gets, then writes a runnable app + studio.config.json.
|
|
164
|
+
Running \`svgrid-studio\` with no arguments starts it too.
|
|
165
|
+
--db <dialect> --url <conn> skip the questions and read a live database
|
|
166
|
+
--from <schema> build from a Drizzle (.ts) or Prisma (.prisma) schema file
|
|
167
|
+
(in-memory data with sample rows)
|
|
168
|
+
--supabase-url <url> --supabase-key <anon> read a Supabase project over its
|
|
169
|
+
REST API (no driver, works without a local database)
|
|
170
|
+
--dataset <id> start from sample data (customers-orders, products-categories,
|
|
171
|
+
projects-tasks, employees-departments, tickets-accounts)
|
|
172
|
+
--title <name> app name
|
|
173
|
+
--out <dir> folder to write the app into (default: .)
|
|
174
|
+
--theme <id> design-system preset --dark dark mode
|
|
175
|
+
-y, --yes take every default, ask nothing
|
|
176
|
+
-f, --force write into a folder that already holds another app
|
|
177
|
+
|
|
178
|
+
Deploy (build first, then the provider CLI; target from --target, else
|
|
179
|
+
studio.config.json, else the adapter in svelte.config.js):
|
|
180
|
+
--target <p> vercel | netlify | cloudflare | node
|
|
181
|
+
--dry-run print the resolved commands without running anything
|
|
182
|
+
|
|
183
|
+
Designer (visual app builder, auto-saves to studio.config.json):
|
|
184
|
+
--template <id> open a ready-made sample app:
|
|
185
|
+
${templateIds()}
|
|
186
|
+
--config <path> studio.config.json to load + auto-save (default: ./studio.config.json)
|
|
187
|
+
--out <dir> folder to write the generated app into (default: .)
|
|
188
|
+
--port <n> port to serve on (default: 4321)
|
|
189
|
+
--no-open don't open the browser
|
|
190
|
+
--ai enable the AI copilot (needs ANTHROPIC_API_KEY in the environment)
|
|
191
|
+
--app-port <n> dev: port for the generated app's dev server (default: designer port + 1)
|
|
192
|
+
|
|
193
|
+
Schema files: a Drizzle schema.ts or a Prisma schema.prisma (auto-detected).
|
|
194
|
+
Foreign keys become searchable relation lookups; enums become select fields.
|
|
195
|
+
|
|
196
|
+
Databases: postgres | supabase | mysql | mssql | sqlite
|
|
197
|
+
(the matching driver - pg / mysql2 / mssql / better-sqlite3 - must be installed)
|
|
198
|
+
|
|
199
|
+
Options:
|
|
200
|
+
--from <path> Drizzle (.ts) or Prisma (.prisma) schema file to introspect
|
|
201
|
+
--db <dialect> Connect to a live database and read its catalog
|
|
202
|
+
--url <conn> Connection string / file path for --db
|
|
203
|
+
--all Scaffold a screen for every table/model (+ nav & home)
|
|
204
|
+
--table <name> Which table/model to use (defaults to <name>)
|
|
205
|
+
--sql Wire a real SQL data source (default with --db)
|
|
206
|
+
--route <seg> Route segment (default: <name> / table name)
|
|
207
|
+
--title <name> --all: app title (default: studio.config.json, else the current layout)
|
|
208
|
+
--api <path> API route path (default: /api/<route>)
|
|
209
|
+
--theme <id> design-system preset (default: ember) - layered, so your own tokens win
|
|
210
|
+
--dark start in dark mode
|
|
211
|
+
--kit <2|3> SvelteKit major (default: 2). 3 needs Vite 8, which StackBlitz cannot run yet
|
|
212
|
+
-h, --help Show this help
|
|
213
|
+
|
|
214
|
+
Examples:
|
|
215
|
+
svgrid-studio init
|
|
216
|
+
svgrid-studio init --db postgres --url $DATABASE_URL --out my-app
|
|
217
|
+
svgrid-studio add customers --from src/lib/db/schema.ts
|
|
218
|
+
svgrid-studio add --all --from prisma/schema.prisma
|
|
219
|
+
svgrid-studio add customers --db postgres --url $DATABASE_URL --sql
|
|
220
|
+
svgrid-studio add --all --db supabase --url $DATABASE_URL
|
|
211
221
|
`;
|
|
212
222
|
/**
|
|
213
223
|
* Terminal prompts for the guided `init`.
|
|
@@ -291,11 +301,13 @@ async function main() {
|
|
|
291
301
|
...(opts.outDir ? { out: opts.outDir } : {}),
|
|
292
302
|
...(opts.db ? { db: opts.db } : {}),
|
|
293
303
|
...(opts.url ? { url: opts.url } : {}),
|
|
304
|
+
...(opts.from ? { from: opts.from } : {}),
|
|
294
305
|
...(opts.supabaseUrl ? { supabaseUrl: opts.supabaseUrl } : {}),
|
|
295
306
|
...(opts.supabaseKey ? { supabaseKey: opts.supabaseKey } : {}),
|
|
296
307
|
...(opts.dataset ? { dataset: opts.dataset } : {}),
|
|
297
308
|
...(opts.theme ? { theme: opts.theme } : {}),
|
|
298
309
|
...(opts.dark ? { dark: true } : {}),
|
|
310
|
+
...(opts.kit ? { kit: opts.kit } : {}),
|
|
299
311
|
...(opts.title ? { title: opts.title } : {}),
|
|
300
312
|
...(opts.yes ? { yes: true } : {}),
|
|
301
313
|
...(opts.force ? { force: true } : {}),
|
|
@@ -469,7 +481,7 @@ async function main() {
|
|
|
469
481
|
for (const table of tables) {
|
|
470
482
|
schemas.push(await introspectDatabase({ dialect: opts.db, table, execute }));
|
|
471
483
|
}
|
|
472
|
-
const res = await runStudioAddApp(schemas, { dataSource: ds, theme: opts.theme, dark: opts.dark }, io);
|
|
484
|
+
const res = await runStudioAddApp(schemas, { dataSource: ds, theme: opts.theme, dark: opts.dark, appTitle: opts.title }, io);
|
|
473
485
|
report(`app (${schemas.length} entities)`, res.written, summarizeVerify(res.verify));
|
|
474
486
|
process.stdout.write(`\nRun \`npm run dev\` and open /\n`);
|
|
475
487
|
return;
|
|
@@ -493,7 +505,7 @@ async function main() {
|
|
|
493
505
|
process.stderr.write('svgrid-studio: no tables/models found in ' + opts.from + '\n');
|
|
494
506
|
process.exit(1);
|
|
495
507
|
}
|
|
496
|
-
const res = await runStudioAddApp(schemas, { dataSource: opts.dataSource, theme: opts.theme, dark: opts.dark }, io);
|
|
508
|
+
const res = await runStudioAddApp(schemas, { dataSource: opts.dataSource, theme: opts.theme, dark: opts.dark, appTitle: opts.title }, io);
|
|
497
509
|
report(`app (${schemas.length} entities)`, res.written, summarizeVerify(res.verify));
|
|
498
510
|
process.stdout.write(`\nRun \`npm run dev\` and open /\n`);
|
|
499
511
|
return;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "commercial",
|
|
5
5
|
"url": "https://svgrid.com/pricing"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.8.
|
|
7
|
+
"version": "0.8.2",
|
|
8
8
|
"description": "SvGrid Studio CLI: scaffold a full CRUD screen (grid + edit panel + SvelteKit API route) from a Drizzle schema in one command.",
|
|
9
9
|
"license": "SEE LICENSE IN LICENSE",
|
|
10
10
|
"author": "jQWidgets <sales@jqwidgets.com>",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@svgrid/enterprise": "^3.
|
|
30
|
+
"@svgrid/enterprise": "^3.1.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.10.7",
|