# setup codegen ```bash= pnpm i -D graphql pnpm i -D @graphql-codegen/cli pnpm i -D @urql/svelte pnpm i -D @types/node pnpm i -D @graphql-codegen/typescript-operations pnpm i -D @parcel/watcher ``` ## setup codegen ```bash= pnpm graphql-codegen init ``` ## urql ```bash= pnpm i -D @urql/svelte ``` ## codegen.ts ```typescript= import type { CodegenConfig } from '@graphql-codegen/cli' export const config: CodegenConfig = { overwrite: true, schema: 'http://0.0.0.0:5100/graphql', documents: 'src/lib/graphql/operations/**/*.ts', generates: { 'src/lib/graphql/generated/graphql.ts': { plugins: [ 'typescript', 'typescript-operations', ] } } } export default config ``` Add script ```jsonld= "codegen": "graphql-codegen --watch --config codegen.ts", ``` ## codegen.yml ```yaml= overwrite: true schema: "http://localhost:5100/graphql/" documents: "src/lib/graphql/*.graphql" generates: src/lib/generated/graphql.ts: plugins: - "typescript" - "typescript-operations" ``` Add script ```jsonld= "codegen": "graphql-codegen --config codegen.yml" ``` ## with headers ```yaml= overwrite: true schema: - "https://corrffzfsdldzdebeugi.supabase.co/graphql/v1": headers: apiKey: "api key here" documents: "src/lib/graphql/operations/**/*.graphql" generates: src/lib/graphql/types.ts: plugins: - "typescript" - "typescript-operations" ``` ## links [CMS-driven IntelliSense in your code editor CMS-driven IntelliSense in your code editor](https://www.voorhoede.nl/en/blog/cms-driven-intellisense-in-your-code-editor/)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up