Skip to content

Commit 2eb0e01

Browse files
committed
docs(graphql-codegen): update README to use type import + satisfies pattern instead of defineConfig
1 parent bbbd062 commit 2eb0e01

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

graphql/codegen/README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -587,55 +587,55 @@ console.log(login.login.apiToken?.accessToken);
587587

588588
### Config File
589589

590-
Create a `graphql-sdk.config.ts` file:
590+
Create a `graphql-codegen.config.ts` file:
591591

592592
```typescript
593-
import { defineConfig } from '@constructive-io/graphql-codegen';
593+
import type { GraphQLSDKConfig } from '@constructive-io/graphql-codegen';
594594

595-
export default defineConfig({
595+
export default {
596596
endpoint: 'https://api.example.com/graphql',
597597
output: './generated/graphql',
598598
headers: {
599599
Authorization: 'Bearer <token>',
600600
},
601601
reactQuery: true,
602602
orm: true,
603-
});
603+
} satisfies GraphQLSDKConfig;
604604
```
605605

606606
### Multi-target Configuration
607607

608-
Configure multiple schema sources and outputs:
608+
For multiple schema sources, export a record of named configs:
609609

610610
```typescript
611-
export default defineConfig({
612-
defaults: {
611+
import type { GraphQLSDKMultiConfig } from '@constructive-io/graphql-codegen';
612+
613+
export default {
614+
public: {
615+
endpoint: 'https://api.example.com/graphql',
616+
output: './generated/public',
613617
headers: { Authorization: 'Bearer <token>' },
618+
reactQuery: true,
614619
},
615-
targets: {
616-
public: {
617-
endpoint: 'https://api.example.com/graphql',
618-
output: './generated/public',
619-
reactQuery: true,
620-
},
621-
admin: {
622-
schemaFile: './admin.schema.graphql',
623-
output: './generated/admin',
624-
orm: true,
625-
},
626-
database: {
627-
db: {
628-
pgpm: { modulePath: './packages/my-module' },
629-
schemas: ['public'],
630-
},
631-
output: './generated/db',
632-
reactQuery: true,
633-
orm: true,
620+
admin: {
621+
schemaFile: './admin.schema.graphql',
622+
output: './generated/admin',
623+
orm: true,
624+
},
625+
database: {
626+
db: {
627+
pgpm: { modulePath: './packages/my-module' },
628+
schemas: ['public'],
634629
},
630+
output: './generated/db',
631+
reactQuery: true,
632+
orm: true,
635633
},
636-
});
634+
} satisfies GraphQLSDKMultiConfig;
637635
```
638636

637+
Run all targets with `graphql-codegen` or a specific target with `graphql-codegen --target public`.
638+
639639
### Glob Patterns
640640

641641
Filter patterns support wildcards:

0 commit comments

Comments
 (0)