This commit is contained in:
cupcakearmy 2021-12-31 10:18:12 +01:00
parent 2bd04341cf
commit e30f21f808
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
5 changed files with 18 additions and 33 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@ node_modules
.env
.env.*
!.env.example
.vercel

View File

@ -1,12 +1,17 @@
# A sane and efficient guide for consuming GraphQL endpoints in Typescript
This is the companion repo to the [blog post]() about GraphQL with Typescript.
This is the companion repo to the [blog post](https://nicco.io/blog/a-sane-and-efficient-guide-for-consuming-graphql-endpoints-in-typescript) about GraphQL with Typescript.
This is skeleton [svelte kit](https://kit.svelte.dev/) app. The relevant files are:
- `.graphqlrc.yml`
- `codegen.yaml`
- `src/lib/gql`
- `.graphqlrc.yml` Editor config
- `codegen.yaml` Generator config
- `src/lib/gql` Folder where I've put the GraphQL stuff
- `src/routes/index.svelte` example usage of the generated SDK
## Demo
You can check a running demo here: https://blog-typescript-graphql.vercel.app
## Running

View File

@ -1,5 +1,5 @@
{
"name": "typescript-graphql",
"name": "blog-typescript-graphql",
"private": true,
"type": "module",
"scripts": {
@ -12,7 +12,7 @@
"@graphql-codegen/typescript": "^2.4.2",
"@graphql-codegen/typescript-graphql-request": "^4.3.3",
"@graphql-codegen/typescript-operations": "^2.2.2",
"@sveltejs/adapter-auto": "next",
"@sveltejs/adapter-static": "next",
"@sveltejs/kit": "next",
"graphql": "^15",
"graphql-request": "^3.7.0",

30
pnpm-lock.yaml generated
View File

@ -5,7 +5,7 @@ specifiers:
'@graphql-codegen/typescript': ^2.4.2
'@graphql-codegen/typescript-graphql-request': ^4.3.3
'@graphql-codegen/typescript-operations': ^2.2.2
'@sveltejs/adapter-auto': next
'@sveltejs/adapter-static': next
'@sveltejs/kit': next
graphql: ^15
graphql-request: ^3.7.0
@ -21,7 +21,7 @@ devDependencies:
'@graphql-codegen/typescript': 2.4.2_graphql@15.8.0
'@graphql-codegen/typescript-graphql-request': 4.3.3_388f816e04241032539fce1de6ab422b
'@graphql-codegen/typescript-operations': 2.2.2_graphql@15.8.0
'@sveltejs/adapter-auto': 1.0.0-next.7
'@sveltejs/adapter-static': 1.0.0-next.24
'@sveltejs/kit': 1.0.0-next.210_svelte@3.44.3
graphql: 15.8.0
graphql-request: 3.7.0_graphql@15.8.0
@ -1127,34 +1127,12 @@ packages:
engines: {node: '>=6'}
dev: true
/@sveltejs/adapter-auto/1.0.0-next.7:
resolution: {integrity: sha512-PGuTgW6bdzKgJJy8a12OCN9ob7/I8ixfWjbBVpKpbjHGc5NmNcS70LoTU55BgVTI7ELp9VoZaJsGFoYp+X5WEw==}
/@sveltejs/adapter-static/1.0.0-next.24:
resolution: {integrity: sha512-lMiwZrZumWRrTQxaj9pFs5oW0h/97spyDl1QjmnkNaA006WeqornoETt31WpU0Lz2/2uYNXvUBBcL1LGc9Vylg==}
dependencies:
'@sveltejs/adapter-cloudflare': 1.0.0-next.5
'@sveltejs/adapter-netlify': 1.0.0-next.37
'@sveltejs/adapter-vercel': 1.0.0-next.34
dev: true
/@sveltejs/adapter-cloudflare/1.0.0-next.5:
resolution: {integrity: sha512-I7kLcINJz0zik+ufb+IAWSn/EHxdTdmGF0M3tizd87Cxw2ke7N/A6XF8YrYDgZ/4yrAcZnR8Texas/5WxPYZ6g==}
dependencies:
esbuild: 0.13.15
dev: true
/@sveltejs/adapter-netlify/1.0.0-next.37:
resolution: {integrity: sha512-Advp53rLMsi9Kg3GYVwWFTmqzIIKCJ2WTrm2zx12Q37RrO+HaY2R+sRMGGGrjD2fk6w1qR7WR9Qt9p0n3moUbw==}
dependencies:
'@iarna/toml': 2.2.5
esbuild: 0.13.15
tiny-glob: 0.2.9
dev: true
/@sveltejs/adapter-vercel/1.0.0-next.34:
resolution: {integrity: sha512-TQDQK2wjDQkoSkNVuFVu4a/hzqKIWCGL15Zi7zQv740ZSd6F2Lg9QHlFfEXMglu6mhoep084h6JiLtzavNiZeA==}
dependencies:
esbuild: 0.13.15
dev: true
/@sveltejs/kit/1.0.0-next.210_svelte@3.44.3:
resolution: {integrity: sha512-Lf0Kb076njOCy9OU1/BPR1gLKTJ9auSGEjaKpgmueLcuRHmnsCh5tNX738uVPQJyJBdRkCVdCdurpFKSkuSyew==}
engines: {node: '>=14.13'}

View File

@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto'
import adapter from '@sveltejs/adapter-static'
import preprocess from 'svelte-preprocess'
/** @type {import('@sveltejs/kit').Config} */