Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Support importing generated code from @timkendall/tql #101

Open
timkendall opened this issue Jan 23, 2022 · 2 comments
Open

Support importing generated code from @timkendall/tql #101

timkendall opened this issue Jan 23, 2022 · 2 comments
Labels
distribution enhancement New feature or request

Comments

@timkendall
Copy link
Owner

Follow the @prisma/client approach as it is a nice DX.

We could expose this as a codegen option w/this being the default (to generate to a non-default location we could take a --output flag).

(Possible) Default Workflow

  1. yarn install @timkendall/tql
  2. Post-install hook looks for a .graphqlconfig or apollo.config.js to discover schema and runs codegen
  3. Generated code is stored in node_modules/@timkendall/tql/.tql/client
  4. User imports their generated code from the module i.e import { query, } from '@timkendall/tql'

(Possible) Custom Workflow (for users who are using tql to generate published SDKs or need more control)

  1. yarn install @timkendall/tql
  2. Manually execute codegen yarn tql <schema> > sdk.ts OR yarn tql <schema> --sdk (interactive prompt?)

image

@timkendall timkendall added enhancement New feature or request distribution labels Jan 23, 2022
@ivasilov
Copy link

ivasilov commented Feb 2, 2022

Please note that this is incompatible with Yarn 2+. There's a discussion at prisma/prisma#1439.

@timkendall
Copy link
Owner Author

Ah I did not know that, thanks for the heads up. Yeah may not be the best idea to do something non-standard like that (though the developer experience is fairly nice).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distribution enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants