Skip to content

Commit

Permalink
feat: configure codegen at repository's root
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel-Melon committed Jan 10, 2024
1 parent 85c6b72 commit c9b04d2
Show file tree
Hide file tree
Showing 3 changed files with 2,133 additions and 30 deletions.
28 changes: 28 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable turbo/no-undeclared-env-vars */

import type { CodegenConfig } from '@graphql-codegen/cli';

const HASURA_GRAPHQL_ADMIN_SECRET = ""
const HASURA_GRAPHQL_ENDPOINT = "";


const config: CodegenConfig = {
overwrite: true,
schema: [HASURA_GRAPHQL_ENDPOINT,
{
[HASURA_GRAPHQL_ENDPOINT]: {
headers: {
"x-hasura-access-key": HASURA_GRAPHQL_ADMIN_SECRET,
},
},
}
],
documents: "packages/lib/graphql/**/*.ts",
generates: {
'./packages/lib/graphql/globalTypes.ts': {
preset: 'client'
}
}
};

export default config;
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,33 @@
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"codegen": "graphql-codegen --config codegen.ts"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@graphql-codegen/introspection": "4.0.0",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-resolvers": "^4.0.1",
"@parcel/watcher": "^2.3.0",
"@turbo/gen": "^1.9.7",
"add": "^2.0.6",
"eslint": "^7.32.0",
"eslint-config-custom": "*",
"prettier": "^2.5.1",
"turbo": "latest"
"ts-node": "^10.9.2",
"turbo": "latest",
"typescript": "^5.3.3",
"yarn": "^1.22.21"
},
"name": "sahil",
"packageManager": "[email protected]",
"workspaces": [
"apps/*",
"packages/*"
]
],
"dependencies": {
"graphql": "^16.8.1"
}
}
Loading

0 comments on commit c9b04d2

Please sign in to comment.