2024-03-26 16:37:36 +03:00
|
|
|
import { CodegenConfig } from '@graphql-codegen/cli';
|
|
|
|
|
|
|
|
const config: CodegenConfig = {
|
2024-06-05 19:16:53 +03:00
|
|
|
schema: [
|
|
|
|
{
|
|
|
|
[`${import.meta.env.VITE_SERVER_BASE_URL}/graphql`]: {
|
|
|
|
// some of the mutations and queries require authorization (people or companies)
|
|
|
|
// so to regenerate the schema with types we need to pass an auth token
|
|
|
|
headers: {
|
|
|
|
Authorization: `Bearer ${import.meta.env.AUTH_TOKEN}`,
|
|
|
|
},
|
2024-05-29 15:45:32 +03:00
|
|
|
},
|
2024-06-05 19:16:53 +03:00
|
|
|
},
|
|
|
|
],
|
2024-03-26 16:37:36 +03:00
|
|
|
overwrite: true,
|
2024-06-05 19:16:53 +03:00
|
|
|
documents: ['./src/**/*.ts', '!src/generated/**/*.*'],
|
2024-03-26 16:37:36 +03:00
|
|
|
generates: {
|
|
|
|
'./src/generated/graphql.tsx': {
|
|
|
|
plugins: [
|
|
|
|
'typescript',
|
|
|
|
'typescript-operations',
|
|
|
|
'typescript-react-apollo',
|
|
|
|
],
|
|
|
|
config: {
|
|
|
|
skipTypename: true,
|
|
|
|
withHooks: true,
|
|
|
|
withHOC: false,
|
|
|
|
withComponent: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default config;
|