create-prisma-generator icon indicating copy to clipboard operation
create-prisma-generator copied to clipboard

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

Open JoeRoddy opened this issue 3 years ago • 2 comments

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!

JoeRoddy avatar Jan 12 '23 03:01 JoeRoddy

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?

YassinEldeeb avatar Jan 13 '23 14:01 YassinEldeeb

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 😆

emab avatar Feb 12 '23 22:02 emab