[FA-misc] Astro migration works, probably want to touchup the frontend but that can be in Phase 4
This commit is contained in:
28
fictionarchive-web-astro/codegen.ts
Normal file
28
fictionarchive-web-astro/codegen.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { CodegenConfig } from '@graphql-codegen/cli';
|
||||
import * as dotenv from 'dotenv';
|
||||
|
||||
dotenv.config({ path: '.env.local' });
|
||||
dotenv.config();
|
||||
|
||||
const schema = process.env.PUBLIC_GRAPHQL_URI ?? 'https://localhost:7063/graphql/';
|
||||
const authToken = process.env.CODEGEN_TOKEN;
|
||||
|
||||
const config: CodegenConfig = {
|
||||
schema: {
|
||||
[schema]: authToken ? { headers: { Authorization: `Bearer ${authToken}` } } : {},
|
||||
},
|
||||
documents: 'src/**/*.graphql',
|
||||
generates: {
|
||||
'src/lib/graphql/__generated__/graphql.ts': {
|
||||
plugins: ['typescript', 'typescript-operations', 'typed-document-node'],
|
||||
config: {
|
||||
avoidOptionals: { field: true },
|
||||
enumsAsConst: true,
|
||||
skipTypename: true,
|
||||
useTypeImports: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user