Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To be able to use custom config path #6

Open
plevavas opened this issue Oct 12, 2021 · 3 comments
Open

To be able to use custom config path #6

plevavas opened this issue Oct 12, 2021 · 3 comments

Comments

@plevavas
Copy link
Contributor

Thanks for this extension!

Graphql-codegen cli uses cosmiconfig to load config file. It would be great if we could set custom config path.

@patryk-smc
Copy link

+1
I prefer JSON config over YML and this extension doesn't seem to work with it.

@lukasholzer
Copy link

maybe a simple glob and support for multiple configs (mono repositories like nx)

import {sync} from 'fast-glob';

const configs = sync(`${firstWorkspaceDirectory()}/**/codegen.{yml,yaml}`)

Creating a Record<string, CodegenContext> where each codegen config holds their context.

for example:

{
  "apps/my-frontend/codegen.yml": {...},
  "libs/other/lib/codegen.yml": {...},
 ...
}

The codegen.yml could then use workspace relative paths:

# libs/other/lib/codegen.yml
generates:
  libs/invotheroice/lib/src/:
    preset: near-operation-file
    plugins:
      - typescript-operations
      - typescript-urql
# apps/my-frontend/codegen.yml
generates:
  apps/my-frontend/src/:
    preset: near-operation-file
    plugins:
      - typescript-operations
      - typescript-urql

@capaj
Copy link
Owner

capaj commented Nov 12, 2021

@patryk-smc this extension should now be able to load all extensions supported by codegen in version 0.9.6

I will add a config for custom path in 1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants