https://github.com/yassineldeeb/create-prisma-generator
Get started developing your own ◭ Prisma generator by running a single command.
https://github.com/yassineldeeb/create-prisma-generator
boilerplate cli cpg create-prisma-generator dev-community generator javascript prisma prisma-generator prisma2 typescript
Last synced: about 2 months ago
JSON representation
Get started developing your own ◭ Prisma generator by running a single command.
- Host: GitHub
- URL: https://github.com/yassineldeeb/create-prisma-generator
- Owner: YassinEldeeb
- License: mit
- Created: 2021-12-19T00:58:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-07T20:44:34.000Z (about 2 years ago)
- Last Synced: 2024-10-19T10:04:43.883Z (7 months ago)
- Topics: boilerplate, cli, cpg, create-prisma-generator, dev-community, generator, javascript, prisma, prisma-generator, prisma2, typescript
- Language: TypeScript
- Homepage:
- Size: 3.22 MB
- Stars: 189
- Watchers: 1
- Forks: 8
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README

## ⚠️ Note
`create-prisma-generator` doesn't support Prisma 4 yet, it works with Prisma 3, but that doesn't mean that you can't upgrade on your own quite smoothly.
Any contributions to support Prisma 4 in the `create-prisma-generator` are highly appreciated and will be part of the authors/contributors section of this tool.
## Prisma> [Prisma](https://www.prisma.io/) is Database ORM Library for Node.js, Typescript.
Prisma has a concept called "Generator". A generator is an executable program, which takes the parsed Prisma schema as an input and has full freedom to output anything.
The most prominent generator is called [`prisma-client-js`](https://github.com/prisma/prisma/tree/main/packages/client). It's the ORM Client powering the main TypeScript and JavaScript usage of Prisma from Node.js.
Generators will always be called when you run `prisma generate`. However, only the generators mentioned in the schema.prisma file are being run.
[Strongly recommend reading the full article, It's pretty damn good](https://prismaio.notion.site/Prisma-Generators-a2cdf262207a4e9dbcd0e362dfac8dc0)
# Motivation
As a community, developing prisma generators is really hard cause that's a very new concept to us so It's like knowing JS but being exposed to do ML with it for the first time and there is nothing documented about **@prisma/sdk** ([this is done intentionally](https://github.com/prisma/prisma/discussions/10721#discussioncomment-1822836)) which has a very great utilities when developing or testing prisma generators and the only way you can get started is by looking at [other generators](https://www.prisma.io/docs/concepts/components/prisma-schema/generators#community-generators) code which might be useful to get you started.I'm really obsessed with this architecture that Prisma Client is built on and I can see a bright future for Prisma Generators from the community to integrate Prisma nicely with different frameworks or make tools that can beneift from Prisma models.
But unfortunately I didn't have a smooth experience developing [my prisma generator](https://github.com/YassinEldeeb/prisma-tgql-types-gen).
So I created this CLI to encourage developers to make their own prisma generators to have a smooth experience with all of the annoying repetitive things carried away like: getting started boilerplate, publishing, testing the gen locally by running `prisma generate`, ..etc
### Also Created a blog on dev.to where we're gonna be discussing the hello world prisma generator together that this CLI has setup for you and the different concepts you'll come across when developing prisma generators, [Check It out here](https://dev.to/yassineldeeb/create-prisma-generator-2mdg)
# Usage
Answer the prompt questions to setup your project, The project setup will be based on your answers.
```sh
npx create-prisma-generator
```# What’s Included?
Your environment will have everything you need to build your prisma generator like an elite open-source maintainer:
- Hello World Prisma Generator.
- Typescript Support.
- JavaScript setup with babel to enable the usage of the latest JS features.
- Automatic publishing workflow with Github Actions.
- Workspace setup for testing the generator locally using `prisma generate`.
- Scripts for development, building, packaging and testing.
- Support for most package-managers `yarn`, `pnpm` and `npm`.
- Automatic semantic release with safety in mind using [commitlint](https://github.com/conventional-changelog/commitlint) & [husky](https://github.com/typicode/husky) to validate your [commit messages](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format).
- Test environment using [Jest](https://github.com/facebook/jest) with an example & fixtures to help you get started.
- Dependabot for keeping dependencies up to date.# Architecture
Read [Architecture.md](https://github.com/YassinEldeeb/create-prisma-generator/blob/main/ARCHITECTURE.md) to understand how everything is working.# Prisma SDK reference
Read [Prisma_SDK_Reference.md](https://github.com/YassinEldeeb/create-prisma-generator/blob/main/PRISMA_SDK_REFERENCE.md)# Community
The Create Prisma Generator community can be found on [GitHub Discussions](https://github.com/YassinEldeeb/create-prisma-generator/discussions), where you can ask questions, suggest ideas, and share your projects.# Contributing
We'll be very thankful for all your contributions, whether it's for helping us find issues in our code, highlighting features that're missing, writing tests for uncovered cases, or contributing to the codebase.Read the [Contributing guide](https://github.com/YassinEldeeb/create-prisma-generator/blob/main/CONTRIBUTING.md) to get started.
### 💚 All Thanks to Prisma's brilliant developers for making such an awesome Node.js ORM that can be easily built on top of it.