brizzle 0.2.3

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # brizzle
2
+
3
+ [![CI](https://github.com/mantaskaveckas/brizzle/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mantaskaveckas/brizzle/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/brizzle)](https://www.npmjs.com/package/brizzle)
5
+ [![npm downloads](https://img.shields.io/npm/dm/brizzle)](https://www.npmjs.com/package/brizzle)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ Rails-like generators for Next.js + Drizzle ORM projects. Generate models, server actions, CRUD pages, and API routes with a single command.
9
+
10
+ [**Documentation**](https://mantaskaveckas.github.io/brizzle/)
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install -g brizzle
16
+ ```
17
+
18
+ Or use with npx:
19
+
20
+ ```bash
21
+ npx brizzle scaffold post title:string body:text
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```bash
27
+ # Generate a full CRUD scaffold (model + actions + pages)
28
+ brizzle scaffold post title:string body:text published:boolean
29
+
30
+ # Generate just model and actions (no views)
31
+ brizzle resource user name:string email:string:unique
32
+
33
+ # Generate model and REST API routes
34
+ brizzle api product name:string price:float
35
+
36
+ # Generate only a model
37
+ brizzle model comment content:text authorId:references:user
38
+
39
+ # Generate only actions for an existing model
40
+ brizzle actions post
41
+ ```
42
+
43
+ ## Commands
44
+
45
+ ### `brizzle model <name> [fields...]`
46
+
47
+ Creates a Drizzle schema model in `db/schema.ts`.
48
+
49
+ ```bash
50
+ brizzle model user name:string email:string:unique
51
+ brizzle model post title:string body:text published:boolean
52
+ brizzle model order total:decimal status:enum:pending,paid,shipped
53
+ ```
54
+
55
+ ### `brizzle actions <name>`
56
+
57
+ Creates server actions file with CRUD operations.
58
+
59
+ ```bash
60
+ brizzle actions user
61
+ ```
62
+
63
+ ### `brizzle resource <name> [fields...]`
64
+
65
+ Creates model + actions (no UI pages).
66
+
67
+ ```bash
68
+ brizzle resource session token:uuid userId:references:user --uuid
69
+ ```
70
+
71
+ ### `brizzle scaffold <name> [fields...]`
72
+
73
+ Creates model + actions + full CRUD pages (list, show, new, edit).
74
+
75
+ ```bash
76
+ brizzle scaffold product name:string price:float description:text?
77
+ ```
78
+
79
+ ### `brizzle api <name> [fields...]`
80
+
81
+ Creates model + REST API route handlers.
82
+
83
+ ```bash
84
+ brizzle api webhook url:string secret:string:unique
85
+ ```
86
+
87
+ ### `brizzle destroy <type> <name>`
88
+
89
+ Removes generated files (does not modify schema).
90
+
91
+ ```bash
92
+ brizzle destroy scaffold post
93
+ brizzle destroy api product --dry-run
94
+ ```
95
+
96
+ ### `brizzle config`
97
+
98
+ Shows detected project configuration.
99
+
100
+ ## Field Types
101
+
102
+ | Type | SQLite | PostgreSQL | MySQL |
103
+ |------|--------|------------|-------|
104
+ | `string` | text | text | varchar(255) |
105
+ | `text` | text | text | text |
106
+ | `integer` / `int` | integer | integer | int |
107
+ | `bigint` | integer | bigint | bigint |
108
+ | `boolean` / `bool` | integer (mode: boolean) | boolean | boolean |
109
+ | `float` | real | doublePrecision | double |
110
+ | `decimal` | text | numeric | decimal |
111
+ | `datetime` / `timestamp` | integer (mode: timestamp) | timestamp | datetime |
112
+ | `date` | integer (mode: timestamp) | date | date |
113
+ | `json` | text | jsonb | json |
114
+ | `uuid` | text | uuid | varchar(36) |
115
+
116
+ ### Special Types
117
+
118
+ - **`enum`**: `status:enum:draft,published,archived`
119
+ - **`references`**: `authorId:references:user`
120
+
121
+ ## Field Modifiers
122
+
123
+ - **Nullable**: Add `?` to make field optional
124
+ ```bash
125
+ brizzle model user bio:text? nickname?
126
+ ```
127
+
128
+ - **Unique**: Add `:unique` modifier
129
+ ```bash
130
+ brizzle model user email:string:unique
131
+ ```
132
+
133
+ ## Options
134
+
135
+ | Option | Description |
136
+ |--------|-------------|
137
+ | `-f, --force` | Overwrite existing files |
138
+ | `-n, --dry-run` | Preview changes without writing |
139
+ | `-u, --uuid` | Use UUID for primary key |
140
+ | `--no-timestamps` | Skip createdAt/updatedAt fields |
141
+
142
+ ## Auto-Detection
143
+
144
+ The generator automatically detects your project configuration:
145
+
146
+ - **Project structure**: `src/app/` vs `app/`
147
+ - **Path aliases**: Reads from `tsconfig.json` (`@/`, `~/`, etc.)
148
+ - **Database dialect**: Reads from `drizzle.config.ts`
149
+ - **DB location**: Checks `db/`, `lib/db/`, `server/db/`
150
+
151
+ Run `brizzle config` to see detected settings.
152
+
153
+ ## Example Output
154
+
155
+ ```bash
156
+ $ brizzle scaffold post title:string body:text published:boolean
157
+
158
+ Scaffolding Post...
159
+
160
+ create db/schema.ts
161
+ create app/posts/actions.ts
162
+ create app/posts/page.tsx
163
+ create app/posts/new/page.tsx
164
+ create app/posts/[id]/page.tsx
165
+ create app/posts/[id]/edit/page.tsx
166
+
167
+ Next steps:
168
+ 1. Run 'pnpm db:push' to update the database
169
+ 2. Run 'pnpm dev' and visit /posts
170
+ ```
171
+
172
+ ## Requirements
173
+
174
+ - Node.js >= 18
175
+ - Next.js project with App Router
176
+ - Drizzle ORM configured
177
+
178
+ ## License
179
+
180
+ MIT
@@ -0,0 +1,2 @@
1
+
2
+ export { }