YassinEldeeb / create-prisma-generator

Get started developing your own ◭ Prisma generator by running a single command.
MIT License
188 stars 8 forks source link

Provide workflow instructions for how to develop / test your custom generator #292

Open JoeRoddy opened 1 year ago

JoeRoddy commented 1 year ago

Hi! Awesome project btw!

Is your feature request related to a problem? Please describe.

Spent about an hour digging through the source code to get a feel for how everything is working. Would be convenient to have explicit directions on how to make changes to the generator and test the updates. I'm now able to make changes and test them in the /usage directory, but tbh I'm still not sure if I'm technically using it correctly.

I feel like the documentation of the usage of the generated codebase is somewhat lacking.

Describe the solution you'd like

Documentation on the correct workflow for making changes to your generator and testing them. Right now my workflow is:

  1. Make changes to /packages/generator/src/generator.ts
  2. cd /packages/generator && npm run prepack
  3. cd /packages/usage && npx prisma migrate

Not sure if there's an easier way, but that's what I arrived at via trial and error.

Could also provide a QOL script in the base directory's package.json: "generate": "cd packages/generator && npm run prepack && cd ../usage && npx prisma generate"

Thanks again for your time making this great project!

YassinEldeeb commented 1 year ago

Hey, I thought the blog I've written does a much better job doing that. check it out https://dev.to/yassineldeeb/create-prisma-generator-2mdg and let me know what do you think?

emab commented 1 year ago

I think the bits I missed out after the initial npx command then running pnpm install was the command mentioned in step 2 (build the generator!).

Fairly obvious now that I think about it but I couldn't work out why pnpm prisma generate in /usage wasn't doing anything for longer than I care to admin 😆