chrishoermann / zod-prisma-types

Generator creates zod types for your prisma models with advanced validation
Other
579 stars 43 forks source link

'Output' option creates directory instead of just file #155

Closed NazCodeland closed 11 months ago

NazCodeland commented 1 year ago

Hey, thank you for this package. I've noticed that the 'output' option creates a new directory + file every time Prisma schemas are generated.

generator Zod {
  provider = "npx zod-prisma-types"
  output   = "../zodSchema/"
}

Inside of ./zodSchema/ I have another file named indexExtended.ts which is always getting deleted every time I generate Prisma schemas. I'll put it outside of that folder for now, but it would be nice if only the file was created. Also, if we could give the file a name of our choosing instead of index.ts with a filename option in the generator :)

Thank you again!

chrishoermann commented 11 months ago

@NazCodeland I don't think this is possible since the generation always needs to delete the previously generated versions of the files to ensure that there are no dead files inside the folders - e.g. when you delete a model in your schema all previously generated files would still be there.

The option with the filename is worth considering but is definitly not a priority on my list.