Skip to content

Commit d4f4468

Browse files
committed
Added configuration example to changeset
1 parent d48282a commit d4f4468

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.changeset/spicy-starfishes-press.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,27 @@
44
---
55

66
Added configuration to allow for custom hash functions for persisted documents in the client preset
7+
8+
### Example
9+
```ts filename="codegen.ts" {10-12}
10+
import { type CodegenConfig } from '@graphql-codegen/cli'
11+
12+
const config: CodegenConfig = {
13+
schema: 'schema.graphql',
14+
documents: ['src/**/*.tsx'],
15+
generates: {
16+
'./src/gql/': {
17+
preset: 'client',
18+
presetConfig: {
19+
persistedDocuments: {
20+
hashAlgorithm: operation => {
21+
const shasum = crypto.createHash('sha512')
22+
shasum.update(operation)
23+
return shasum.digest('hex')
24+
}
25+
}
26+
}
27+
}
28+
}
29+
}
30+
```

0 commit comments

Comments
 (0)