1.1.1 • Published 7 months ago
prisma-enums-generator v1.1.1
Prisma Enums Generator
Generates enums from your prisma schema to typescript or graphql files. Note it doesn't generate the typescript or types for shapes.
Installation
npm install prisma-enums-generator
Usage
generator enums {
provider = "prisma-enums-generator"
isExport = true
useComma = true
// output = "path to file"
}
Example
generator client {
provider = "prisma-client-js"
}
generator enums {
provider = "prisma-enums-generator"
isExport = true
useComma = true
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum UserType {
pro
best
}
model User {
id String @unique @default(uuid())
name String
username String
type UserType
}
Generates
npx prisma generate
It will default generate the following file, prisma/types/index.ts with the following code
export enum UserType {
pro,
best,
}
Contributing
If you'd like to contribute, please follow our contribution guidelines.
Support
If you like the project, please consider supporting us by giving a ⭐️ on Github.
Bugs
If you find a bug, please file an issue on our issue tracker on GitHub
License
prisma-enums-generator is open-source software licensed under the MIT license.