@cvsa/prisma-zod 3.2.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/LICENSE +21 -0
- package/README.md +50 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 alikia2x
|
|
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,50 @@
|
|
|
1
|
+
# prisma-zod
|
|
2
|
+
|
|
3
|
+
A [Prisma generator](https://www.prisma.io/docs/orm/prisma-schema/overview/generators) that auto-generates [Zod](https://zod.dev) schemas from your Prisma models.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- [Prisma](https://www.npmjs.com/package/prisma) v7+
|
|
8
|
+
- [Zod](https://www.npmjs.com/package/zod) v4+
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
> [!NOTE]
|
|
13
|
+
> This package is **ESM only**.
|
|
14
|
+
|
|
15
|
+
Pick your favorite package manager:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm i -D @cvsa/prisma-zod
|
|
19
|
+
yarn add -D @cvsa/prisma-zod
|
|
20
|
+
pnpm i -D @cvsa/prisma-zod
|
|
21
|
+
bun i -D @cvsa/prisma-zod
|
|
22
|
+
deno add -D npm:@cvsa/prisma-zod
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Add the generator to your `schema.prisma`:
|
|
28
|
+
|
|
29
|
+
```prisma
|
|
30
|
+
generator zod {
|
|
31
|
+
provider = "prisma-zod"
|
|
32
|
+
output = "./zod"
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Run `prisma generate`, then import your schemas:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { UserSchema, PostSchema } from "./zod"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Contributing
|
|
43
|
+
|
|
44
|
+
See [CONTRIBUTING](./CONTRIBUTING.md) for development setup and guidelines.
|
|
45
|
+
|
|
46
|
+
Found a type mismatch between `prisma-client` and the generated Zod schema? Please [open an issue](https://github.com/project-cvsa/prisma-zod-generator/issues/new).
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
[MIT](./LICENSE)
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cvsa/prisma-zod",
|
|
3
|
+
"module": "dist/index.js",
|
|
4
|
+
"version": "3.2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"prisma-zod": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"format": "biome format --write .",
|
|
13
|
+
"lint": "biome lint .",
|
|
14
|
+
"biome:ci": "biome ci .",
|
|
15
|
+
"test": "bunx --bun turbo test:raw",
|
|
16
|
+
"test:raw": "bun test",
|
|
17
|
+
"build": "bunx --bun turbo build:raw",
|
|
18
|
+
"build:raw": "bun build.ts"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@biomejs/biome": "^2.4.8",
|
|
22
|
+
"@prisma/dmmf": "^7.5.0",
|
|
23
|
+
"@types/bun": "latest",
|
|
24
|
+
"prisma": "^7.5.0",
|
|
25
|
+
"turbo": "^2.8.20",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@prisma/client": ">= 7.0.0",
|
|
30
|
+
"prisma": ">= 7.0.0",
|
|
31
|
+
"zod": "^4.3.6"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@prisma/generator-helper": "^7.5.0"
|
|
35
|
+
},
|
|
36
|
+
"packageManager": "bun@1.3.11",
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/"
|
|
39
|
+
]
|
|
40
|
+
}
|