omar-dulaimi / prisma-zod-generator

Prisma 2+ generator to emit Zod schemas from your Prisma schema
MIT License
543 stars 45 forks source link

prisma-zod-generator did not generate anything #96

Closed ningx-nvidia closed 1 month ago

ningx-nvidia commented 1 month ago

Bug description

tl;dr; prisma-zod-generator did not generate anything in the generated folder, in the log no errors found.

How to reproduce

create a t3 stack app like this: pnpm create t3-app@latest

install prisma-zod-generator

add to schema.prisma generator zod { provider = "prisma-zod-generator" }

run npx prisma generator

in the generated folder, only a folder called schemas was generated, no ts files.

Expected behavior

the zod schema files should be generated in the generated folder.

Prisma information

// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client { provider = "prisma-client-js" }

generator zod { provider = "prisma-zod-generator" }

datasource db { provider = "mysql" // NOTE: When using mysql or sqlserver, uncomment the @db.Text annotations in model Account below // Further reading: // https://next-auth.js.org/adapters/prisma#create-the-prisma-schema // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string url = env("DATABASE_URL") }

// Necessary for Next auth model Account { id String @id @default(cuid()) userId String type String provider String providerAccountId String refresh_token String? @db.Text access_token String? @db.Text expires_at Int? token_type String? scope String? id_token String? @db.Text session_state String? user User @relation(fields: [userId], references: [id], onDelete: Cascade) refresh_token_expires_in Int? ext_expires_in Int?

@@unique([provider, providerAccountId]) }

model Session { id String @id @default(cuid()) sessionToken String @unique userId String expires DateTime user User @relation(fields: [userId], references: [id], onDelete: Cascade) }

model User { id String @id @default(cuid()) name String? email String? @unique emailVerified DateTime? image String? accounts Account[] sessions Session[] }

model VerificationToken { identifier String token String @unique expires DateTime

@@unique([identifier, token]) }

Environment & setup

Prisma Version

prisma                  : 5.21.0
@prisma/client          : 5.21.0
Computed binaryTarget   : darwin-arm64
Operating System        : darwin
Architecture            : arm64
Node.js                 : v20.9.0
Query Engine (Node-API) : libquery-engine 08713a93b99d58f31485621c634b04983ae01d95 (at node_modules/.pnpm/@prisma+engines@5.21.0/node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Schema Engine           : schema-engine-cli 08713a93b99d58f31485621c634b04983ae01d95 (at node_modules/.pnpm/@prisma+engines@5.21.0/node_modules/@prisma/engines/schema-engine-darwin-arm64)
Schema Wasm             : @prisma/prisma-schema-wasm 5.21.0-36.08713a93b99d58f31485621c634b04983ae01d95
Default Engines Hash    : 08713a93b99d58f31485621c634b04983ae01d95
Studio                  : 0.503.0
ningx-nvidia commented 1 month ago

I don't know why, but after remove the prettier.config.js and the .prettierrrc.json, then the problem is solved.

it looks like this:

const config = { plugins: ["prettier-plugin-tailwindcss"], };

{ "arrowParens": "always", "bracketSpacing": true, "endOfLine": "auto", "semi": true, "singleQuote": true, "trailingComma": "all", "plugins": ["prettier-plugin-tailwindcss"] }

export default config;

does anyone know why?