sizuku 0.0.1 → 0.0.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.
Files changed (2) hide show
  1. package/README.md +78 -91
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -1,13 +1,12 @@
1
1
  # Sizuku
2
2
 
3
- Welcome to **Sizuku**! This tool takes annotations in your code comments and turns them into useful documentation and validation artifacts automatically. Whether you’re looking to visualize your database schema, generate detailed ER documentation, or create type-safe validation schemas, Sizuku has got you covered.
3
+ **[Sizuku](https://www.npmjs.com/package/sizuku)** is a tool that generates Valibot validation schemas and ER diagrams from commented [Drizzle](https://orm.drizzle.team/) schemas.
4
4
 
5
- ## What Can Sizuku Do for You?
5
+ ## Features
6
6
 
7
- - **Mermaid ER Diagrams:** Easily see your database tables and how they relate to one another with a clear, visual diagram generated in Mermaid syntax.
8
- - **ER Definitions:** Automatically create comprehensive documentation of your database schema, including detailed column definitions, relationships, and more.
9
- - **Validation Schemas:** Generate type-safe validation schemas using either [Zod](https://zod.dev/) or [Valibot](https://valibot.dev/) based on your code annotations (`@z` for Zod, `@v` for Valibot).
10
- - **Clear Relationship Definitions:** Use the `@relation` annotation in your code to explicitly define how tables are linked (e.g., one-to-many, many-to-many). This ensures that both your ER diagrams and documentation accurately reflect your database relationships.
7
+ - 💎 Automatically generates [Zod](https://zod.dev/) schemas from your Drizzle schema
8
+ - 🤖 Automatically generates [Valibot](https://valibot.dev/) schemas from your Drizzle schema
9
+ - 📊 Creates [Mermaid](https://mermaid.js.org/) ER diagrams
11
10
 
12
11
 
13
12
  ## Getting Started
@@ -119,42 +118,6 @@ export const likes = mysqlTable(
119
118
  )
120
119
  ```
121
120
 
122
- ### Mermaid ER
123
-
124
- ```bash
125
- npx sizuku-mermaid-er path/to/db/schema.ts -o path/to/output.md
126
- ```
127
-
128
- output:
129
-
130
- ```mermaid
131
- erDiagram
132
- user ||--o{ post : "(id) - (userId)"
133
- post ||--o{ likes : "(id) - (postId)"
134
- user ||--o{ likes : "(id) - (userId)"
135
- user {
136
- varchar id "(PK) Unique identifier for the user."
137
- varchar username "Username of the user."
138
- varchar email "Email address of the user."
139
- varchar password "Password for the user."
140
- timestamp createdAt "Timestamp when the user was created."
141
- timestamp updatedAt "Timestamp when the user was last updated."
142
- }
143
- post {
144
- varchar id "(PK) Unique identifier for the post."
145
- varchar userId "(FK) ID of the user who created the post."
146
- varchar content "Content of the post."
147
- timestamp createdAt "Timestamp when the post was created."
148
- timestamp updatedAt "Timestamp when the post was last updated."
149
- }
150
- likes {
151
- varchar id "(PK) Unique identifier for the like."
152
- varchar postId "(FK) ID of the post that is liked."
153
- varchar userId "(FK) ID of the user who liked the post."
154
- timestamp createdAt "Timestamp when the like was created."
155
- }
156
- ```
157
-
158
121
  ### Zod
159
122
 
160
123
  ```bash
@@ -317,31 +280,44 @@ export const LikesSchema = v.object({
317
280
  })
318
281
  ```
319
282
 
320
- ## Configuration
321
-
322
- ### sizuku-mermaid-er.json
323
-
324
- | Option | Type | Default | Description |
325
- |--------|------|---------|-------------|
326
- | `input` | `string` | `""` | Input file path |
327
- | `output` | `string` | `""` | Output file path |
283
+ ### Mermaid ER
328
284
 
329
- > **⚠️** When using a configuration file, command line arguments are not required. The configuration file settings take precedence over command line arguments.
330
- >
331
- > When you have configured `sizuku-mermaid-er.json`, you can simply run:
332
- > ```bash
333
- > npx sizuku-mermaid-er
334
- > ```
285
+ ```bash
286
+ npx sizuku-mermaid-er path/to/db/schema.ts -o path/to/output.md
287
+ ```
335
288
 
336
- #### Example
289
+ output:
337
290
 
338
- ```json
339
- {
340
- "input": "db/schema.ts",
341
- "output": "mermaid-er/ER.md"
342
- }
291
+ ```mermaid
292
+ erDiagram
293
+ user ||--o{ post : "(id) - (userId)"
294
+ post ||--o{ likes : "(id) - (postId)"
295
+ user ||--o{ likes : "(id) - (userId)"
296
+ user {
297
+ varchar id "(PK) Unique identifier for the user."
298
+ varchar username "Username of the user."
299
+ varchar email "Email address of the user."
300
+ varchar password "Password for the user."
301
+ timestamp createdAt "Timestamp when the user was created."
302
+ timestamp updatedAt "Timestamp when the user was last updated."
303
+ }
304
+ post {
305
+ varchar id "(PK) Unique identifier for the post."
306
+ varchar userId "(FK) ID of the user who created the post."
307
+ varchar content "Content of the post."
308
+ timestamp createdAt "Timestamp when the post was created."
309
+ timestamp updatedAt "Timestamp when the post was last updated."
310
+ }
311
+ likes {
312
+ varchar id "(PK) Unique identifier for the like."
313
+ varchar postId "(FK) ID of the post that is liked."
314
+ varchar userId "(FK) ID of the user who liked the post."
315
+ timestamp createdAt "Timestamp when the like was created."
316
+ }
343
317
  ```
344
318
 
319
+ ## Configuration
320
+
345
321
  ### sizuku-zod.json
346
322
 
347
323
  #### Schema Options
@@ -399,30 +375,30 @@ export const LikesSchema = v.object({
399
375
 
400
376
  #### Schema Options
401
377
 
402
- | Option | Type | Default | Description |
403
- |--------|------|---------|-------------|
404
- | `name` | `"PascalCase"` \| `"camelCase"` | `"PascalCase"` | Naming convention for generated schema variables |
405
- | `export` | `boolean` | `false` | When true, exports all schema definitions |
378
+ | Option | Type | Default | Description |
379
+ |----------|---------------------------------|----------------|--------------------------------------------|
380
+ | `name` | `"PascalCase"` \| `"camelCase"` | `"PascalCase"` | Naming convention for generated schema variables |
381
+ | `export` | `boolean` | `false` | When true, exports all schema definitions |
406
382
 
407
383
  #### Type Options
408
384
 
409
- | Option | Type | Default | Description |
410
- |--------|------|---------|-------------|
411
- | `name` | `"PascalCase"` \| `"camelCase"` | `"PascalCase"` | Naming convention for generated type definitions |
412
- | `export` | `boolean` | `false` | When true, exports all type definitions |
385
+ | Option | Type | Default | Description |
386
+ |----------|---------------------------------|----------------|-----------------------------------------|
387
+ | `name` | `"PascalCase"` \| `"camelCase"` | `"PascalCase"` | Naming convention for generated type definitions |
388
+ | `export` | `boolean` | `false` | When true, exports all type definitions |
413
389
 
414
390
  #### Comment Options
415
391
 
416
- | Option | Type | Default | Description |
417
- |--------|------|---------|-------------|
418
- | `name` | `boolean` | `false` | If enabled, includes the element's original name in TSDoc comments. |
392
+ | Option | Type | Default | Description |
393
+ |--------|----------------|---------|---------------------------------------------------------------------|
394
+ | `name` | `boolean` | `false` | If enabled, includes the element's original name in TSDoc comments. |
419
395
 
420
396
  #### Input and Output
421
397
 
422
- | Option | Type | Default | Description |
423
- |--------|------|---------|-------------|
424
- | `input` | `string` | `""` | Input file path |
425
- | `output` | `string` | `""` | Output file path |
398
+ | Option | Type | Default | Description |
399
+ |--------|------|-------------|-------------|
400
+ | `input` | `string` | `""` | Input file path |
401
+ | `output` | `string` | `""` | Output file path |
426
402
 
427
403
  #### Examples
428
404
 
@@ -443,28 +419,39 @@ export const LikesSchema = v.object({
443
419
 
444
420
  > **⚠️** When using a configuration file, command line arguments are not required. The configuration file settings take precedence over command line arguments.
445
421
  >
446
- > When you have configured `sizuku-zod.json`, you can simply run:
422
+ > When you have configured `sizuku-valibot.json`, you can simply run:
447
423
  > ```bash
448
424
  > npx sizuku-valibot
449
425
  > ```
450
426
 
451
- This project is in **early development** and being maintained by a developer with about 2 years of experience. While I'm doing my best to create a useful tool:
427
+ ### sizuku-mermaid-er.json
452
428
 
453
- ### ⚠️ WARNING: Potential Breaking Changes Without Notice
429
+ | Option | Type | Default | Description |
430
+ |--------|-------------------|------------------|
431
+ | `input` | `string` | `""` | Input file path |
432
+ | `output` | `string` | `""` | Output file path |
454
433
 
455
- **This package is in active development and may introduce breaking changes without prior notice.**
456
- Specifically:
457
- - Query parameter coercion behavior may change
458
- - Schema generation logic might be updated
459
- - Output code structure could be modified
460
- - Example value handling might be altered
434
+ #### Example
461
435
 
462
- We strongly recommend:
463
- - Pinning to exact versions in production
464
- - Testing thoroughly when updating versions
465
- - Reviewing generated code after updates
436
+ ```json
437
+ {
438
+ "input": "db/schema.ts",
439
+ "output": "mermaid-er/ER.md"
440
+ }
441
+ ```
442
+
443
+ > **⚠️** When using a configuration file, command line arguments are not required. The configuration file settings take precedence over command line arguments.
444
+ >
445
+ > When you have configured `sizuku-mermaid-er.json`, you can simply run:
446
+ > ```bash
447
+ > npx sizuku-mermaid-er
448
+ > ```
449
+
450
+ This project is in **early development** and being maintained by a developer with about 2 years of experience. While I'm doing my best to create a useful tool:
451
+
452
+ ### ⚠️ WARNING: Potential Breaking Changes Without Notice
466
453
 
467
- We welcome feedback and contributions to improve the tool!
454
+ **This package is in active development and may introduce breaking changes without prior notice.
468
455
 
469
456
  ## License
470
457
 
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "sizuku",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
+ "description": "Sizuku is a tool that automatically generates Valibot validation schemas and Mermaid ER diagrams from commented Drizzle schemas.",
4
5
  "license": "MIT",
5
6
  "keywords": [
6
7
  "drizzle",