@beignet/cli 0.0.8 → 0.0.10
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/CHANGELOG.md +18 -0
- package/README.md +68 -67
- package/dist/choices.d.ts +32 -3
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +54 -3
- package/dist/choices.js.map +1 -1
- package/dist/create-prompts.d.ts +5 -4
- package/dist/create-prompts.d.ts.map +1 -1
- package/dist/create-prompts.js +22 -4
- package/dist/create-prompts.js.map +1 -1
- package/dist/create.d.ts +7 -1
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +14 -4
- package/dist/create.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/inspect.js +78 -12
- package/dist/inspect.js.map +1 -1
- package/dist/make.d.ts +21 -1
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +210 -37
- package/dist/make.js.map +1 -1
- package/dist/templates/base.d.ts.map +1 -1
- package/dist/templates/base.js +80 -10
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/db/index.d.ts +21 -0
- package/dist/templates/db/index.d.ts.map +1 -0
- package/dist/templates/db/index.js +14 -0
- package/dist/templates/db/index.js.map +1 -0
- package/dist/templates/db/mysql.d.ts +4 -0
- package/dist/templates/db/mysql.d.ts.map +1 -0
- package/dist/templates/db/mysql.js +972 -0
- package/dist/templates/db/mysql.js.map +1 -0
- package/dist/templates/db/postgres.d.ts +4 -0
- package/dist/templates/db/postgres.d.ts.map +1 -0
- package/dist/templates/db/postgres.js +863 -0
- package/dist/templates/db/postgres.js.map +1 -0
- package/dist/templates/db/sqlite.d.ts +3 -0
- package/dist/templates/db/sqlite.d.ts.map +1 -0
- package/dist/templates/db/sqlite.js +878 -0
- package/dist/templates/db/sqlite.js.map +1 -0
- package/dist/templates/db.js +16 -16
- package/dist/templates/index.d.ts +5 -5
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +21 -20
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/server.d.ts +3 -3
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +149 -97
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shared.d.ts +34 -1
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +45 -0
- package/dist/templates/shared.js.map +1 -1
- package/package.json +2 -2
- package/src/choices.ts +70 -3
- package/src/create-prompts.ts +25 -3
- package/src/create.ts +25 -3
- package/src/index.ts +29 -5
- package/src/inspect.ts +137 -19
- package/src/make.ts +265 -34
- package/src/templates/base.ts +96 -10
- package/src/templates/db/index.ts +34 -0
- package/src/templates/db/mysql.ts +976 -0
- package/src/templates/db/postgres.ts +867 -0
- package/src/templates/{db.ts → db/sqlite.ts} +47 -168
- package/src/templates/index.ts +24 -19
- package/src/templates/server.ts +161 -97
- package/src/templates/shared.ts +90 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @beignet/cli
|
|
2
2
|
|
|
3
|
+
## 0.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2972ee4: `beignet create` supports `--db sqlite|postgres|mysql` (default `sqlite`), with a matching database prompt in interactive setup. Each backend scaffolds end to end: provider wiring, an idiomatic Drizzle schema, the vendored initial migration, env examples (`POSTGRES_DB_URL`, `MYSQL_DB_URL`), and a dialect-matched test database — in-memory libSQL for SQLite, in-process PGlite for Postgres, and a real server via `MYSQL_TEST_URL` for MySQL. `make resource` and `make feature` detect the app's database and generate dialect-correct schema and repository code, and `beignet db generate|migrate` work unchanged for every dialect.
|
|
8
|
+
- @beignet/core@0.0.10
|
|
9
|
+
|
|
10
|
+
## 0.0.9
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 6ebec8c: Provider packages can now declare `variants` in their `beignet.provider` manifest — one entry per selectable backend with its own env requirements and registration tokens. `beignet doctor` checks required env vars only for the variants an app actually registers, and reports a single registration hint listing all variants when none is wired. The Drizzle database provider uses this to describe its sqlite, postgres, and mysql backends.
|
|
15
|
+
- 1bb42a3: Rename `@beignet/provider-drizzle-turso` to `@beignet/provider-db-drizzle`, with databases as subpath exports. Import from `@beignet/provider-db-drizzle/sqlite`; `DrizzleTurso*` symbols are now `DrizzleSqlite*`, the provider registers as `drizzle-sqlite`, and the connection env vars are `SQLITE_DB_URL` and `SQLITE_DB_AUTH_TOKEN` (the auth token applies to hosted libSQL such as Turso). Provider packages now follow `provider-<capability>-<implementation>` naming, and multi-backend implementations add backends as subpaths — `/postgres` and `/mysql` are planned next.
|
|
16
|
+
- Updated dependencies [6ebec8c]
|
|
17
|
+
- Updated dependencies [6ebec8c]
|
|
18
|
+
- Updated dependencies [1bb42a3]
|
|
19
|
+
- @beignet/core@0.0.9
|
|
20
|
+
|
|
3
21
|
## 0.0.8
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -39,18 +39,18 @@ Both delegate to `beignet create`, so `bunx @beignet/cli create my-app` is
|
|
|
39
39
|
equivalent.
|
|
40
40
|
|
|
41
41
|
Running create in an interactive terminal without selection flags opens a
|
|
42
|
-
prompt-based setup that asks for the project directory,
|
|
43
|
-
|
|
44
|
-
(`--
|
|
45
|
-
prompts, and `--yes` forces the
|
|
46
|
-
|
|
47
|
-
behave exactly as before.
|
|
42
|
+
prompt-based setup that asks for the project directory, whether to scaffold
|
|
43
|
+
an API-only app, which database to use, and which provider integrations to
|
|
44
|
+
add. Passing any selection flag (`--api`, `--db`, `--integrations`, or
|
|
45
|
+
`--package-manager`) skips the prompts, and `--yes` forces the
|
|
46
|
+
non-interactive defaults (the full-stack SQLite starter with `bun`) even on a
|
|
47
|
+
terminal. Non-interactive runs in scripts and CI behave exactly as before.
|
|
48
48
|
|
|
49
49
|
By default the CLI creates a Next.js app with:
|
|
50
50
|
|
|
51
51
|
- Contract-first todos API routes
|
|
52
52
|
- Better Auth routes and Beignet auth provider wiring
|
|
53
|
-
- Drizzle
|
|
53
|
+
- Drizzle persistence — SQLite (libSQL) by default, with `--db postgres` and `--db mysql` for the other backends
|
|
54
54
|
- UOW, audit logging, durable idempotency, and a durable outbox drain route
|
|
55
55
|
- Jobs, events, listeners, schedules, mail-backed notifications, and uploads
|
|
56
56
|
- App-owned ports with provider-backed infra adapters
|
|
@@ -62,6 +62,58 @@ By default the CLI creates a Next.js app with:
|
|
|
62
62
|
- React Hook Form
|
|
63
63
|
- OpenAPI output
|
|
64
64
|
|
|
65
|
+
Pass `--api` to scaffold an API-only app. It keeps the same contracts, auth,
|
|
66
|
+
persistence, and devtools, and swaps the UI shell for a minimal API landing
|
|
67
|
+
page and a reduced typed client.
|
|
68
|
+
|
|
69
|
+
The starter ships local production-shaped defaults: Better Auth, Drizzle
|
|
70
|
+
persistence, pino logging, UOW, durable idempotency, a durable outbox, audit
|
|
71
|
+
logging, and devtools. Add external service integrations only when you want
|
|
72
|
+
those providers:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bunx @beignet/cli create my-app --integrations inngest,resend
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Available integrations:
|
|
79
|
+
|
|
80
|
+
- `inngest` - Inngest-backed background jobs via `@beignet/provider-inngest`
|
|
81
|
+
- `resend` - Resend-backed mail via `@beignet/provider-mail-resend`
|
|
82
|
+
- `upstash-rate-limit` - Upstash-backed rate limiting via
|
|
83
|
+
`@beignet/provider-rate-limit-upstash`
|
|
84
|
+
|
|
85
|
+
Each selected integration adds its provider package dependencies, wires the
|
|
86
|
+
provider in `server/providers.ts`, extends `.env.example`, and writes setup
|
|
87
|
+
notes to `docs/integrations.md`.
|
|
88
|
+
|
|
89
|
+
Drizzle persistence ships in every starter; pick the backend with `--db`
|
|
90
|
+
(default `sqlite`):
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
bunx @beignet/cli create my-app --db postgres
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`--db` accepts `sqlite` (libSQL, local files plus hosted libSQL/Turso),
|
|
97
|
+
`postgres` (node-postgres, requires a running Postgres 14+ server), and
|
|
98
|
+
`mysql` (`mysql2`, requires MySQL 8.0+). Every backend scaffolds the same
|
|
99
|
+
structure: `infra/db/schema/`, `infra/db/repositories.ts`,
|
|
100
|
+
`infra/db/test-database.ts`, SQL-backed idempotency and outbox tables, a
|
|
101
|
+
Drizzle todo repository adapter, `drizzle.config.ts` with the matching
|
|
102
|
+
dialect, checked-in starter migrations, database scripts, and env examples
|
|
103
|
+
(`SQLITE_*`, `POSTGRES_DB_URL`, or `MYSQL_DB_URL`), so the generated todo
|
|
104
|
+
resource uses durable persistence instead of an in-memory repository.
|
|
105
|
+
Postgres starters run repository tests against in-process PGlite with no
|
|
106
|
+
server; MySQL persistence tests need a real server via `MYSQL_TEST_URL`.
|
|
107
|
+
Later `make feature` or `make resource` calls detect the app's backend from
|
|
108
|
+
`infra/db/repositories.ts` and generate a dialect-correct Drizzle
|
|
109
|
+
table/repository plus an in-memory test fake.
|
|
110
|
+
|
|
111
|
+
Better Auth also ships in every starter. The scaffold adds the Better Auth
|
|
112
|
+
Next.js route, Beignet auth provider wiring, typed `UNAUTHORIZED` and
|
|
113
|
+
`FORBIDDEN` errors, a request-bound authorization gate, and
|
|
114
|
+
`requireUser(ctx)`. Use hooks for HTTP boundary authentication and use cases
|
|
115
|
+
or policies for business authorization.
|
|
116
|
+
|
|
65
117
|
Preview the planned files without writing anything:
|
|
66
118
|
|
|
67
119
|
```bash
|
|
@@ -75,7 +127,6 @@ The CLI writes files only. After creation:
|
|
|
75
127
|
cd my-app
|
|
76
128
|
bun install
|
|
77
129
|
cp .env.example .env.local
|
|
78
|
-
bun beignet db generate
|
|
79
130
|
bun beignet db migrate
|
|
80
131
|
bun run dev
|
|
81
132
|
```
|
|
@@ -116,6 +167,7 @@ beignet make job <feature>/<name> [options]
|
|
|
116
167
|
beignet make notification <feature>/<name> [options]
|
|
117
168
|
beignet make listener <feature>/<name> --event <feature>/<event> [options]
|
|
118
169
|
beignet make schedule <feature>/<name> [options]
|
|
170
|
+
beignet make upload <feature>/<name> [options]
|
|
119
171
|
beignet make port <name> [options]
|
|
120
172
|
beignet make policy <name> [options]
|
|
121
173
|
beignet make adapter <name> [options]
|
|
@@ -136,10 +188,10 @@ beignet --version
|
|
|
136
188
|
|
|
137
189
|
Options:
|
|
138
190
|
--template next Template to use. Currently only `next`.
|
|
139
|
-
--
|
|
191
|
+
--api Scaffold an API-only app without the UI shell.
|
|
192
|
+
--db postgres Database backend: sqlite (default), postgres, or mysql.
|
|
140
193
|
--package-manager bun Package manager shown in next steps.
|
|
141
|
-
--
|
|
142
|
-
--integrations inngest,pino Add integrations. Accepts one value or a comma-separated list.
|
|
194
|
+
--integrations inngest,resend Add integrations: inngest, resend, upstash-rate-limit. Accepts one value or a comma-separated list.
|
|
143
195
|
--yes Skip interactive create prompts and use the defaults.
|
|
144
196
|
--force Write into a non-empty directory.
|
|
145
197
|
--dry-run Preview create/make writes without changing files.
|
|
@@ -220,7 +272,7 @@ shell or source the rc file to activate completions. Zsh completions require
|
|
|
220
272
|
`compinit` to be loaded, which most zsh setups already do.
|
|
221
273
|
|
|
222
274
|
Completions cover commands, subcommands, flags, and enum flag values such as
|
|
223
|
-
`--
|
|
275
|
+
`--template` and `--integrations`. The shell scripts call the
|
|
224
276
|
`beignet completion propose` helper, which prints one proposal per line for a
|
|
225
277
|
partial command line; it exists for the shell integration and is safe to
|
|
226
278
|
ignore otherwise. Completions complete whatever `beignet` resolves to on your
|
|
@@ -628,8 +680,10 @@ package script to restore.
|
|
|
628
680
|
`db reset` is intentionally app-owned because destructive behavior depends on
|
|
629
681
|
the environment. The standard starter refuses to reset non-local database URLs
|
|
630
682
|
unless `BEIGNET_ALLOW_DATABASE_RESET=true` is set. Drizzle starters also include
|
|
631
|
-
`infra/db/test-database.ts`, which creates an isolated
|
|
632
|
-
repository and persistence tests
|
|
683
|
+
`infra/db/test-database.ts`, which creates an isolated test database for
|
|
684
|
+
repository and persistence tests: an in-memory libSQL database for SQLite, an
|
|
685
|
+
in-process PGlite database for Postgres, or a real server via `MYSQL_TEST_URL`
|
|
686
|
+
for MySQL.
|
|
633
687
|
|
|
634
688
|
Generate feature-owned test factories and local/demo seeds with:
|
|
635
689
|
|
|
@@ -795,59 +849,6 @@ artifacts are already registered individually, the fix bails out and the
|
|
|
795
849
|
diagnostic stays. Listener registration is report-only because apps own their
|
|
796
850
|
event-bus wiring.
|
|
797
851
|
|
|
798
|
-
Available presets:
|
|
799
|
-
|
|
800
|
-
- `minimal` - choose this when you want the small contract/core/server/use-case loop without the full app conventions.
|
|
801
|
-
- `standard` - choose this when you want the full app layout with Better Auth, Drizzle/libSQL, UOW, durable idempotency, outbox, audit logging, devtools, provider wiring, health checks, typed clients, feature-owned jobs/events/schedules/uploads/notifications, and separated `ports/` + `infra/`.
|
|
802
|
-
|
|
803
|
-
The standard preset includes the local production-shaped defaults: Better Auth,
|
|
804
|
-
Drizzle/libSQL, Pino logging, local storage, devtools, UOW, durable idempotency, outbox, audit
|
|
805
|
-
logging, and feature-owned background workflow examples. Add external service
|
|
806
|
-
integrations only when you want those providers:
|
|
807
|
-
|
|
808
|
-
```bash
|
|
809
|
-
bun create beignet my-app --preset standard --integrations drizzle-turso,inngest,resend
|
|
810
|
-
```
|
|
811
|
-
|
|
812
|
-
Available features:
|
|
813
|
-
|
|
814
|
-
- `client`
|
|
815
|
-
- `react-query`
|
|
816
|
-
- `forms`
|
|
817
|
-
- `openapi`
|
|
818
|
-
|
|
819
|
-
Available integrations:
|
|
820
|
-
|
|
821
|
-
- `better-auth`
|
|
822
|
-
- `drizzle-turso`
|
|
823
|
-
- `inngest`
|
|
824
|
-
- `pino`
|
|
825
|
-
- `resend`
|
|
826
|
-
- `upstash-rate-limit`
|
|
827
|
-
|
|
828
|
-
With `--preset standard`, Drizzle/libSQL is included by default. The starter scaffolds `infra/db/schema/`, `infra/db/repositories.ts`, `infra/db/test-database.ts`, SQL-backed idempotency and outbox tables, a Drizzle todo repository adapter, `drizzle.config.ts`, database scripts, and `TURSO_*` env examples so the generated todo resource uses durable persistence instead of the in-memory repository. Later `make feature` or `make resource` calls in that app generate both a Drizzle table/repository and an in-memory test fake.
|
|
829
|
-
|
|
830
|
-
With `--preset minimal --integrations drizzle-turso`, the starter keeps the
|
|
831
|
-
small app shape and scaffolds the smallest durable wiring: `drizzle.config.ts`,
|
|
832
|
-
a todos-only schema in `infra/db/schema/`, a Drizzle todo repository in
|
|
833
|
-
`infra/todos/`, and an app-owned database provider in `infra/db/provider.ts`
|
|
834
|
-
that contributes the deferred `todos` port and creates and seeds the starter
|
|
835
|
-
table at startup. The generated `db:generate` and `db:migrate` scripts work
|
|
836
|
-
with `beignet db ...`; the `db:seed` and `db:reset` scripts are
|
|
837
|
-
standard-preset-only because their entrypoints are not scaffolded.
|
|
838
|
-
|
|
839
|
-
With `--preset standard`, Better Auth is included by default. The starter adds
|
|
840
|
-
the Better Auth Next.js route, Beignet auth provider wiring, typed
|
|
841
|
-
`UNAUTHORIZED` and `FORBIDDEN` errors, a request-bound authorization gate, and
|
|
842
|
-
`requireUser(ctx)`. Use hooks for HTTP boundary authentication and use cases or
|
|
843
|
-
policies for business authorization.
|
|
844
|
-
|
|
845
|
-
With `--preset minimal --integrations better-auth`, the starter wires an
|
|
846
|
-
app-owned `lib/better-auth.ts` backed by Better Auth's in-memory adapter, the
|
|
847
|
-
`app/api/auth/[...all]` route, `createAuthBetterAuthProvider(...)` behind a
|
|
848
|
-
deferred `auth` port, and an `auth` session on the request context. Users and
|
|
849
|
-
sessions reset on restart; switch to a database adapter before production.
|
|
850
|
-
|
|
851
852
|
## License
|
|
852
853
|
|
|
853
854
|
MIT
|
package/dist/choices.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Choice lists
|
|
3
|
-
* heavier scaffold/generator modules. Keeping them
|
|
4
|
-
* flag enums
|
|
2
|
+
* Choice lists, string-literal types, and small pure helpers shared by the
|
|
3
|
+
* CLI entrypoint and the heavier scaffold/generator modules. Keeping them
|
|
4
|
+
* here lets the bin define flag enums and next steps without loading
|
|
5
|
+
* templates or generators at startup.
|
|
5
6
|
*/
|
|
6
7
|
/**
|
|
7
8
|
* Package managers supported by the app template generator.
|
|
@@ -18,6 +19,10 @@ export type TemplateName = "next";
|
|
|
18
19
|
* integrations that add an external service remain selectable.
|
|
19
20
|
*/
|
|
20
21
|
export type IntegrationName = "inngest" | "resend" | "upstash-rate-limit";
|
|
22
|
+
/**
|
|
23
|
+
* Databases supported by the starter's Drizzle persistence layer.
|
|
24
|
+
*/
|
|
25
|
+
export type DatabaseName = "sqlite" | "postgres" | "mysql";
|
|
21
26
|
/**
|
|
22
27
|
* Supported scaffold template choices.
|
|
23
28
|
*/
|
|
@@ -30,6 +35,30 @@ export declare const packageManagerChoices: readonly ["bun", "npm", "pnpm", "yar
|
|
|
30
35
|
* Supported scaffold integration choices.
|
|
31
36
|
*/
|
|
32
37
|
export declare const integrationChoices: readonly ["inngest", "resend", "upstash-rate-limit"];
|
|
38
|
+
/**
|
|
39
|
+
* Supported scaffold database choices.
|
|
40
|
+
*/
|
|
41
|
+
export declare const databaseChoices: readonly ["sqlite", "postgres", "mysql"];
|
|
42
|
+
/**
|
|
43
|
+
* Local database name derived from the app name.
|
|
44
|
+
*
|
|
45
|
+
* Postgres and MySQL database identifiers are stricter than project names,
|
|
46
|
+
* so dashes and dots become underscores. Used by `.env.example`, the
|
|
47
|
+
* generated drizzle config, and the create command's next steps, which must
|
|
48
|
+
* all point at the same local database.
|
|
49
|
+
*/
|
|
50
|
+
export declare function databaseLocalName(appName: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Docker one-liner that starts a local database matching the generated
|
|
53
|
+
* `.env.example` connection URL. Returns undefined for SQLite, which needs
|
|
54
|
+
* no server.
|
|
55
|
+
*/
|
|
56
|
+
export declare function databaseStartCommand(database: DatabaseName, appName: string): string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Local development connection URL matching `databaseStartCommand`.
|
|
59
|
+
* Used as the `.env.example` value and the generated env defaults.
|
|
60
|
+
*/
|
|
61
|
+
export declare function databaseLocalUrl(database: DatabaseName, appName: string): string;
|
|
33
62
|
/**
|
|
34
63
|
* Shells supported by `beignet completion install` and `uninstall`.
|
|
35
64
|
*/
|
package/dist/choices.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC;AAC1E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,mBAEgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB,yCAKY,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAIgB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,eAAe,0CAIgB,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAWpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,CAWR;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,0BAGY,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,uBAAuB,oIAa1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/choices.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Choice lists
|
|
3
|
-
* heavier scaffold/generator modules. Keeping them
|
|
4
|
-
* flag enums
|
|
2
|
+
* Choice lists, string-literal types, and small pure helpers shared by the
|
|
3
|
+
* CLI entrypoint and the heavier scaffold/generator modules. Keeping them
|
|
4
|
+
* here lets the bin define flag enums and next steps without loading
|
|
5
|
+
* templates or generators at startup.
|
|
5
6
|
*/
|
|
6
7
|
/**
|
|
7
8
|
* Supported scaffold template choices.
|
|
@@ -26,6 +27,56 @@ export const integrationChoices = [
|
|
|
26
27
|
"resend",
|
|
27
28
|
"upstash-rate-limit",
|
|
28
29
|
];
|
|
30
|
+
/**
|
|
31
|
+
* Supported scaffold database choices.
|
|
32
|
+
*/
|
|
33
|
+
export const databaseChoices = [
|
|
34
|
+
"sqlite",
|
|
35
|
+
"postgres",
|
|
36
|
+
"mysql",
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Local database name derived from the app name.
|
|
40
|
+
*
|
|
41
|
+
* Postgres and MySQL database identifiers are stricter than project names,
|
|
42
|
+
* so dashes and dots become underscores. Used by `.env.example`, the
|
|
43
|
+
* generated drizzle config, and the create command's next steps, which must
|
|
44
|
+
* all point at the same local database.
|
|
45
|
+
*/
|
|
46
|
+
export function databaseLocalName(appName) {
|
|
47
|
+
return appName.replaceAll(/[^a-z0-9_]/g, "_");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Docker one-liner that starts a local database matching the generated
|
|
51
|
+
* `.env.example` connection URL. Returns undefined for SQLite, which needs
|
|
52
|
+
* no server.
|
|
53
|
+
*/
|
|
54
|
+
export function databaseStartCommand(database, appName) {
|
|
55
|
+
const databaseName = databaseLocalName(appName);
|
|
56
|
+
switch (database) {
|
|
57
|
+
case "postgres":
|
|
58
|
+
return `docker run --rm -d -e POSTGRES_USER=beignet -e POSTGRES_PASSWORD=beignet -e POSTGRES_DB=${databaseName} -p 5432:5432 postgres:17-alpine`;
|
|
59
|
+
case "mysql":
|
|
60
|
+
return `docker run --rm -d -e MYSQL_ROOT_PASSWORD=beignet -e MYSQL_DATABASE=${databaseName} -p 3306:3306 mysql:8.4`;
|
|
61
|
+
default:
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Local development connection URL matching `databaseStartCommand`.
|
|
67
|
+
* Used as the `.env.example` value and the generated env defaults.
|
|
68
|
+
*/
|
|
69
|
+
export function databaseLocalUrl(database, appName) {
|
|
70
|
+
const databaseName = databaseLocalName(appName);
|
|
71
|
+
switch (database) {
|
|
72
|
+
case "postgres":
|
|
73
|
+
return `postgres://beignet:beignet@127.0.0.1:5432/${databaseName}`;
|
|
74
|
+
case "mysql":
|
|
75
|
+
return `mysql://root:beignet@127.0.0.1:3306/${databaseName}`;
|
|
76
|
+
default:
|
|
77
|
+
return "file:local.db";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
29
80
|
/**
|
|
30
81
|
* Supported completion shell choices.
|
|
31
82
|
*/
|
package/dist/choices.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAA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;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,KAAK;IACL,MAAM;IACN,cAAc;IACd,eAAe;IACf,MAAM;IACN,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,SAAS;CACD,CAAC"}
|
package/dist/create-prompts.d.ts
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* `@clack/prompts` is loaded lazily inside the prompt flow so non-interactive
|
|
6
6
|
* runs and CLI startup never pay for it.
|
|
7
7
|
*/
|
|
8
|
-
import { type IntegrationName, type PackageManager } from "./choices.js";
|
|
8
|
+
import { type DatabaseName, type IntegrationName, type PackageManager } from "./choices.js";
|
|
9
9
|
/**
|
|
10
10
|
* Selections shared by create flags and interactive prompt answers.
|
|
11
11
|
*/
|
|
12
12
|
export type CreateSelections = {
|
|
13
13
|
directory?: string;
|
|
14
14
|
api?: boolean;
|
|
15
|
+
db?: DatabaseName;
|
|
15
16
|
integrations?: readonly IntegrationName[];
|
|
16
17
|
packageManager?: PackageManager;
|
|
17
18
|
};
|
|
@@ -26,9 +27,9 @@ type CreatePromptTty = {
|
|
|
26
27
|
* Decide whether `beignet create` should run the interactive prompt flow.
|
|
27
28
|
*
|
|
28
29
|
* Prompts run only on a full TTY, only when `--yes` is absent, and only when
|
|
29
|
-
* no selection flag was passed. Any explicit api, integration, or
|
|
30
|
-
* manager selection means the invocation is scripted, so the
|
|
31
|
-
* path stays byte-identical for agents and CI.
|
|
30
|
+
* no selection flag was passed. Any explicit api, database, integration, or
|
|
31
|
+
* package manager selection means the invocation is scripted, so the
|
|
32
|
+
* non-interactive path stays byte-identical for agents and CI.
|
|
32
33
|
*/
|
|
33
34
|
export declare function shouldPromptInteractively(flags: CreatePromptFlags, tty: CreatePromptTty): boolean;
|
|
34
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-prompts.d.ts","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[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EF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,eAAe,GACnB,OAAO,CAWT;AAcD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAwDvC"}
|
package/dist/create-prompts.js
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* `@clack/prompts` is loaded lazily inside the prompt flow so non-interactive
|
|
6
6
|
* runs and CLI startup never pay for it.
|
|
7
7
|
*/
|
|
8
|
-
import { integrationChoices, } from "./choices.js";
|
|
8
|
+
import { databaseChoices, integrationChoices, } from "./choices.js";
|
|
9
9
|
/**
|
|
10
10
|
* Decide whether `beignet create` should run the interactive prompt flow.
|
|
11
11
|
*
|
|
12
12
|
* Prompts run only on a full TTY, only when `--yes` is absent, and only when
|
|
13
|
-
* no selection flag was passed. Any explicit api, integration, or
|
|
14
|
-
* manager selection means the invocation is scripted, so the
|
|
15
|
-
* path stays byte-identical for agents and CI.
|
|
13
|
+
* no selection flag was passed. Any explicit api, database, integration, or
|
|
14
|
+
* package manager selection means the invocation is scripted, so the
|
|
15
|
+
* non-interactive path stays byte-identical for agents and CI.
|
|
16
16
|
*/
|
|
17
17
|
export function shouldPromptInteractively(flags, tty) {
|
|
18
18
|
if (!tty.stdin || !tty.stdout)
|
|
@@ -20,6 +20,7 @@ export function shouldPromptInteractively(flags, tty) {
|
|
|
20
20
|
if (flags.yes)
|
|
21
21
|
return false;
|
|
22
22
|
const selectionFlagPassed = flags.api !== undefined ||
|
|
23
|
+
flags.db !== undefined ||
|
|
23
24
|
(flags.integrations?.length ?? 0) > 0 ||
|
|
24
25
|
flags.packageManager !== undefined;
|
|
25
26
|
return !selectionFlagPassed;
|
|
@@ -29,6 +30,11 @@ const integrationHints = {
|
|
|
29
30
|
resend: "Resend-backed mail provider",
|
|
30
31
|
"upstash-rate-limit": "Upstash-backed rate limiting",
|
|
31
32
|
};
|
|
33
|
+
const databaseHints = {
|
|
34
|
+
sqlite: "libSQL/Turso, zero setup — default",
|
|
35
|
+
postgres: "node-postgres, requires a Postgres 14+ server",
|
|
36
|
+
mysql: "mysql2, requires MySQL 8.0+",
|
|
37
|
+
};
|
|
32
38
|
/**
|
|
33
39
|
* Run the interactive `beignet create` prompt flow.
|
|
34
40
|
*
|
|
@@ -56,6 +62,17 @@ export async function promptCreateSelections(initial) {
|
|
|
56
62
|
});
|
|
57
63
|
if (prompts.isCancel(api))
|
|
58
64
|
return undefined;
|
|
65
|
+
const db = await prompts.select({
|
|
66
|
+
message: "Which database?",
|
|
67
|
+
options: databaseChoices.map((database) => ({
|
|
68
|
+
value: database,
|
|
69
|
+
label: database,
|
|
70
|
+
hint: databaseHints[database],
|
|
71
|
+
})),
|
|
72
|
+
initialValue: initial.db ?? "sqlite",
|
|
73
|
+
});
|
|
74
|
+
if (prompts.isCancel(db))
|
|
75
|
+
return undefined;
|
|
59
76
|
const integrations = await prompts.multiselect({
|
|
60
77
|
message: "Add provider integrations? (press enter to skip)",
|
|
61
78
|
options: integrationChoices.map((integration) => ({
|
|
@@ -71,6 +88,7 @@ export async function promptCreateSelections(initial) {
|
|
|
71
88
|
return {
|
|
72
89
|
directory,
|
|
73
90
|
api,
|
|
91
|
+
db,
|
|
74
92
|
integrations,
|
|
75
93
|
packageManager: initial.packageManager,
|
|
76
94
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-prompts.js","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,kBAAkB,GAEnB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"create-prompts.js","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,eAAe,EAEf,kBAAkB,GAEnB,MAAM,cAAc,CAAC;AAsBtB;;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S;QACT,GAAG;QACH,EAAE;QACF,YAAY;QACZ,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;AACJ,CAAC"}
|
package/dist/create.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IntegrationName, type PackageManager, type TemplateName } from "./templates/index.js";
|
|
1
|
+
import { type DatabaseName, type IntegrationName, type PackageManager, type TemplateName } from "./templates/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Options for creating a new Beignet app.
|
|
4
4
|
*/
|
|
@@ -12,6 +12,11 @@ export type CreateOptions = {
|
|
|
12
12
|
api?: boolean;
|
|
13
13
|
packageManager?: PackageManager;
|
|
14
14
|
integrations?: IntegrationName[];
|
|
15
|
+
/**
|
|
16
|
+
* Database backing the starter's Drizzle persistence layer.
|
|
17
|
+
* Defaults to "sqlite".
|
|
18
|
+
*/
|
|
19
|
+
db?: DatabaseName;
|
|
15
20
|
force?: boolean;
|
|
16
21
|
dryRun?: boolean;
|
|
17
22
|
beignetVersion?: string;
|
|
@@ -26,6 +31,7 @@ export type CreateResult = {
|
|
|
26
31
|
dryRun: boolean;
|
|
27
32
|
files: string[];
|
|
28
33
|
packageManager: PackageManager;
|
|
34
|
+
database: DatabaseName;
|
|
29
35
|
};
|
|
30
36
|
/**
|
|
31
37
|
* Create a Beignet app from the starter template.
|
package/dist/create.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAG9B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC;;;OAGG;IACH,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAsDvB"}
|
package/dist/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir, readdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { getTemplateFiles, integrationChoices, } from "./templates/index.js";
|
|
3
|
+
import { databaseChoices, getTemplateFiles, integrationChoices, } from "./templates/index.js";
|
|
4
4
|
import { getCliVersion } from "./version.js";
|
|
5
5
|
/**
|
|
6
6
|
* Create a Beignet app from the starter template.
|
|
@@ -13,9 +13,13 @@ export async function createProject(options) {
|
|
|
13
13
|
const template = options.template ?? "next";
|
|
14
14
|
const api = Boolean(options.api);
|
|
15
15
|
const integrations = resolveIntegrations(options.integrations ?? []);
|
|
16
|
+
const database = options.db ?? "sqlite";
|
|
16
17
|
if (template !== "next") {
|
|
17
18
|
throw new Error(`Unknown template "${template}". Available templates: next`);
|
|
18
19
|
}
|
|
20
|
+
if (!databaseChoices.includes(database)) {
|
|
21
|
+
throw new Error(`Unknown database "${database}". Available databases: ${databaseChoices.join(", ")}`);
|
|
22
|
+
}
|
|
19
23
|
const dryRun = Boolean(options.dryRun);
|
|
20
24
|
await assertCanWrite(targetDir, Boolean(options.force));
|
|
21
25
|
const files = getTemplateFiles({
|
|
@@ -24,6 +28,7 @@ export async function createProject(options) {
|
|
|
24
28
|
beignetVersion: options.beignetVersion ?? getDefaultBeignetVersion(),
|
|
25
29
|
api,
|
|
26
30
|
integrations,
|
|
31
|
+
database,
|
|
27
32
|
});
|
|
28
33
|
if (!dryRun) {
|
|
29
34
|
await mkdir(targetDir, { recursive: true });
|
|
@@ -40,17 +45,22 @@ export async function createProject(options) {
|
|
|
40
45
|
dryRun,
|
|
41
46
|
files: files.map((file) => file.path),
|
|
42
47
|
packageManager,
|
|
48
|
+
database,
|
|
43
49
|
};
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
52
|
* Providers that ship in every starter. They used to be `--integrations`
|
|
47
53
|
* choices, so passing them gets a pointed error instead of a generic one.
|
|
48
54
|
*/
|
|
49
|
-
const baseProviderNames = new Set(["better-auth", "drizzle-
|
|
55
|
+
const baseProviderNames = new Set(["better-auth", "drizzle-sqlite", "pino"]);
|
|
50
56
|
function resolveIntegrations(explicitIntegrations) {
|
|
51
57
|
for (const integration of explicitIntegrations) {
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
const integrationName = integration;
|
|
59
|
+
if (baseProviderNames.has(integrationName)) {
|
|
60
|
+
const databaseHint = integrationName === "drizzle-sqlite"
|
|
61
|
+
? " Choose the starter database with --db sqlite|postgres|mysql instead."
|
|
62
|
+
: "";
|
|
63
|
+
throw new Error(`${integration} is part of every Beignet starter and no longer an --integrations choice.${databaseHint}`);
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
66
|
const integrations = new Set(explicitIntegrations);
|
package/dist/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAEL,eAAe,EACf,gBAAgB,EAEhB,kBAAkB,GAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAsC7C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAsB;IAEtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC;IAC5C,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC;IAExC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,C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I,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,aAAa,SAAS,8CAA8C,CACrE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAIL,KAAK,cAAc,EAInB,KAAK,4BAA4B,EACjC,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAIL,KAAK,cAAc,EAInB,KAAK,4BAA4B,EACjC,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAoBvB,KAAK,UAAU,GAAG,cAAc,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC,CAAC;AAm8CF,wBAAsB,IAAI,CACxB,MAAM,WAAwB,EAC9B,OAAO,GAAE,4BAA4B,CAAC,UAAU,CAAe,GAC9D,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|