tql
tql copied to clipboard
Support importing generated code from `@timkendall/tql`
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
-
yarn install @timkendall/tql
- Post-install hook looks for a
.graphqlconfig
orapollo.config.js
to discover schema and runs codegen - Generated code is stored in
node_modules/@timkendall/tql/.tql/client
- 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)
-
yarn install @timkendall/tql
- Manually execute codegen
yarn tql <schema> > sdk.ts
ORyarn tql <schema> --sdk
(interactive prompt?)
Please note that this is incompatible with Yarn 2+. There's a discussion at https://github.com/prisma/prisma/issues/1439.
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).