redwood icon indicating copy to clipboard operation
redwood copied to clipboard

Adds a way to opt-out of the web or API's type generation

Open orta opened this issue 1 year ago • 6 comments

The check on whether the web types should be generated is based on effectively looking at all files in web for any graphql tagged strings in TS/JS files. Which would likely hit every graphql client which exists to my knowledge.

This PR adds a config option to explicitly disable the type generation, it'll save a small amount of time pretty often (but I'm more interested in trying to keep the number of types in my codebase down).

If you're (very reasonably IMO) config-phobic I totally get it 👍🏻

orta avatar Jun 12 '23 13:06 orta

@orta the option seems reasonable to me but @dac09 what do you think since you've worked more on this part of the codebase than I have? At the very least I'll run the name of the config option by the team, but I don't have any immediate reservations

jtoar avatar Jun 12 '23 21:06 jtoar

Seems reasonable to me @orta - but I think the name createOperationTypes may not make sense to most other people (including me, out of context ;)).

What if we made this gql-type-generation, or we had a separate block for typegen?

[typegen] 
  graphql = ['web', 'api'] # 👈 we can remove web from here?

The risk here ofcourse is that we keep expanding the toml indefinitely, but also not sure how much finegrained control we need to give users.

dac09 avatar Jun 13 '23 09:06 dac09

Sure, I'm not tied to the config option.

I think your array style is better - I'll give it a few days for others to give feedback and switch it out to that

orta avatar Jun 13 '23 12:06 orta

Hi @orta and @dac09 Is it worth picking up this one to get it across the finish? Recommendations otherwise?

thedavidprice avatar Mar 26 '24 21:03 thedavidprice

Its worth my time to re-pick up, if I recall the web side of the type gen takes ages and I can't run type generation on my own watcher because of it

orta avatar Mar 27 '24 00:03 orta

Re-written with feedback addresssed

orta avatar May 02 '24 12:05 orta

I'm gonna close this, I think for most projects it's a rarity to want this - and I'm not using Redwood's codegen anymore

orta avatar Aug 28 '24 07:08 orta