chore: Add graphql-codegen pipeline

Have graphql-codegen run with yarn dev:dev, and have it read
graphql files and output them in the generated folder
This commit is contained in:
joy_void_joy 2022-07-20 14:28:19 +02:00
parent 2e5ea40953
commit 77c6b68f61
4 changed files with 2105 additions and 47 deletions

3
web/.gitignore vendored
View File

@ -2,4 +2,5 @@
.next
node_modules
out
tsconfig.tsbuildinfo
tsconfig.tsbuildinfo
generated

25
web/codegen.yml Normal file
View File

@ -0,0 +1,25 @@
overwrite: true
schema: lib/api/graphql/**/**.graphql
documents: null
generates:
generated/graphql_api.ts:
config:
useIndexSignature: true
inputMaybeValue: undefined | T
maybeValue: undefined | T
strictScalars: true
plugins:
- 'typescript'
- 'typescript-resolvers'
generated/schema.graphql:
plugins:
- 'schema-ast'
hooks:
afterAllFileWrite:
- prettier --write

View File

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "concurrently -n NEXT,TS -c magenta,cyan \"next dev -p 3000\" \"yarn ts --watch\"",
"devdev": "cross-env NEXT_PUBLIC_FIREBASE_ENV=DEV concurrently -n NEXT,TS -c magenta,cyan \"cross-env FIREBASE_ENV=DEV next dev -p 3000\" \"cross-env FIREBASE_ENV=DEV yarn ts --watch\"",
"devdev": "cross-env NEXT_PUBLIC_FIREBASE_ENV=DEV concurrently -n NEXT,TS,GRAPHQL -c magenta,cyan,yellow \"cross-env FIREBASE_ENV=DEV next dev -p 3000\" \"cross-env FIREBASE_ENV=DEV yarn ts --watch\" \"yarn generate --watch lib/api/graphql/**/**.graphql \"",
"dev:dev": "yarn devdev",
"dev:the": "cross-env NEXT_PUBLIC_FIREBASE_ENV=THEOREMONE concurrently -n NEXT,TS -c magenta,cyan \"cross-env FIREBASE_ENV=THEOREMONE next dev -p 3000\" \"cross-env FIREBASE_ENV=THEOREMONE yarn ts --watch\"",
"dev:emulate": "cross-env NEXT_PUBLIC_FIREBASE_EMULATE=TRUE yarn devdev",
@ -15,7 +15,12 @@
"format": "npx prettier --write .",
"postbuild": "next-sitemap",
"verify": "(cd .. && yarn verify)",
"verify:dir": "npx prettier --check .; yarn lint --max-warnings 0; tsc --pretty --project tsconfig.json --noEmit"
"verify:dir": "npx prettier --check .; yarn lint --max-warnings 0; tsc --pretty --project tsconfig.json --noEmit",
"generate": "graphql-codegen --config codegen.yml",
"predev": "yarn generate",
"prebuild": "yarn generate",
"prets": "yarn generate",
"prelint": "yarn generate"
},
"dependencies": {
"@amplitude/analytics-browser": "0.4.1",
@ -53,6 +58,9 @@
"string-similarity": "^4.0.4"
},
"devDependencies": {
"@graphql-codegen/cli": "2.6.2",
"@graphql-codegen/typescript": "2.5.1",
"@graphql-codegen/typescript-resolvers": "2.6.6",
"@tailwindcss/forms": "0.4.0",
"@tailwindcss/line-clamp": "^0.3.1",
"@tailwindcss/typography": "^0.5.1",

2112
yarn.lock

File diff suppressed because it is too large Load Diff