[FA-18] Frontend bootstrapped
This commit is contained in:
40
fictionarchive-web/codegen.ts
Normal file
40
fictionarchive-web/codegen.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import type { CodegenConfig } from '@graphql-codegen/cli'
|
||||
|
||||
const schema =
|
||||
process.env.CODEGEN_SCHEMA_URL ??
|
||||
process.env.VITE_GRAPHQL_URI ??
|
||||
'https://localhost:5001/graphql'
|
||||
|
||||
const authToken = process.env.VITE_CODEGEN_TOKEN ?? process.env.CODEGEN_TOKEN
|
||||
const headers = authToken
|
||||
? {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
}
|
||||
: undefined
|
||||
|
||||
const config: CodegenConfig = {
|
||||
schema: {
|
||||
[schema]: { headers },
|
||||
},
|
||||
documents: 'src/**/*.graphql',
|
||||
generates: {
|
||||
'src/__generated__/graphql.ts': {
|
||||
plugins: [
|
||||
'typescript',
|
||||
'typescript-operations',
|
||||
'typescript-react-apollo',
|
||||
],
|
||||
config: {
|
||||
withHooks: true,
|
||||
avoidOptionals: true,
|
||||
dedupeFragments: true,
|
||||
maybeValue: 'T | null',
|
||||
skipTypename: true,
|
||||
apolloReactHooksImportFrom: '@apollo/client/react',
|
||||
},
|
||||
},
|
||||
},
|
||||
ignoreNoDocuments: true,
|
||||
}
|
||||
|
||||
export default config
|
||||
Reference in New Issue
Block a user