graphql-let icon indicating copy to clipboard operation
graphql-let copied to clipboard

Generate types in place other than `node_modules` (v0.18.0)

Open sachinraja opened this issue 3 years ago • 4 comments

Whenever I make a change to my packages and the node_modules folder is updated, I have to regenerate the types. Is there a way I can specify a folder to generate types in, other than node_modules/graphql-let/__generated__/__types__?.

sachinraja avatar May 21 '21 16:05 sachinraja

Hi @cloudagon, I didn't know the behavior. Thanks for letting me know.

You probably mean node_modules/@types/graphql-let/__generated__/__types__.d.ts, generated in the default typeInjectEntrypoint directory. Not tested, but setting typeInjectEntrypoint: typings/graphql-let.d.ts or something must avoid it.

piglovesyou avatar May 24 '21 15:05 piglovesyou

It just generates an empty file in the specified location. This aligns with node_modules/@types/graphql-let/__generated__/index.d.ts.

sachinraja avatar May 24 '21 17:05 sachinraja

dirname(config.typeInjectEntrypoint) is supposed to be a directory graphql-let generates types in, but I have no test case for it. The file having empty content is ok. It only gets to have declarations when needed. I'm happy if you (or anyone):

  1. describe what happens when you change typeInjectEntrypoint and what problem remains still
  2. make a PR of the reproduction test case
  3. make a PR to solve it

piglovesyou avatar May 25 '21 01:05 piglovesyou

When I set the following:

typeInjectEntrypoint: src/types/graphql-let

no types are generated. An empty file called graphql-let is generated in src/types and the node_modules/@types/graphql-let is not created.

full config:

schema: src/graphql/**/*.graphqls
documents: src/graphql/**/*.graphql
typeInjectEntrypoint: src/types/graphql-let
plugins:
  - typescript-operations
  - typescript-react-apollo
config:
  enumValues:
    Language: '@prisma/client#Language'
  enumPrefix: GQL
cacheDir: .cache/graphql-let

I'm willing to look into this, but I'm not even sure where to start.

sachinraja avatar May 25 '21 03:05 sachinraja