added basic houdini graphql client incl. test query

This commit is contained in:
Samuel Andert 2023-07-29 15:09:21 +02:00
parent 414705e0b4
commit fa5764c303
12 changed files with 8849 additions and 111 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
$houdini

9
.graphqlrc.yaml Normal file
View File

@ -0,0 +1,9 @@
projects:
default:
schema:
- ./schema.graphql
- ./$houdini/graphql/schema.graphql
documents:
- '**/*.gql'
- '**/*.svelte'
- ./$houdini/graphql/documents.gql

13
houdini.config.js Normal file
View File

@ -0,0 +1,13 @@
/// <references types="houdini-svelte">
/** @type {import('houdini').ConfigFile} */
const config = {
"watchSchema": {
"url": "https://graphql.andert.me/api/graphql"
},
"plugins": {
"houdini-svelte": {}
}
}
export default config

View File

@ -1,59 +1,61 @@
{
"name": "svelte",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"test:integration": "playwright test",
"test:unit": "vitest"
},
"devDependencies": {
"@iconify/svelte": "^3.1.4",
"@playwright/test": "^1.36.2",
"@skeletonlabs/skeleton": "^1.10.0",
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.22.3",
"@tailwindcss/forms": "^0.5.4",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-svelte": "^2.32.4",
"postcss": "^8.4.27",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.1.1",
"svelte-check": "^3.4.6",
"sveltekit-superforms": "^1.5.0",
"tailwindcss": "^3.3.3",
"tslib": "^2.6.1",
"typescript": "^5.1.6",
"vite": "^4.4.7",
"vitest": "^0.32.4",
"zod": "^3.21.4"
},
"type": "module",
"dependencies": {
"@lit-protocol/auth-helpers": "^2.2.47",
"@lit-protocol/constants": "^2.2.47",
"@lit-protocol/lit-auth-client": "^2.2.47",
"@lit-protocol/lit-node-client": "^2.2.47",
"@lit-protocol/pkp-client": "^2.2.47",
"@lit-protocol/pkp-ethers": "^2.2.47",
"@lit-protocol/pkp-walletconnect": "^2.2.47",
"@lit-protocol/types": "^2.2.47",
"@sveltejs/vite-plugin-svelte": "^2.4.3",
"@wagmi/core": "^1.3.8",
"@xstate/svelte": "^2.1.0",
"viem": "^1.4.2",
"xstate": "^4.38.2"
}
"name": "svelte",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"test:integration": "playwright test",
"test:unit": "vitest"
},
"devDependencies": {
"@iconify/svelte": "^3.1.4",
"@playwright/test": "^1.36.2",
"@skeletonlabs/skeleton": "^1.10.0",
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.22.3",
"@tailwindcss/forms": "^0.5.4",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-svelte": "^2.32.4",
"postcss": "^8.4.27",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.1.1",
"svelte-check": "^3.4.6",
"sveltekit-superforms": "^1.5.0",
"tailwindcss": "^3.3.3",
"tslib": "^2.6.1",
"typescript": "^5.1.6",
"vite": "^4.4.7",
"vitest": "^0.32.4",
"zod": "^3.21.4",
"houdini": "^1.2.8",
"houdini-svelte": "^1.2.8"
},
"type": "module",
"dependencies": {
"@lit-protocol/auth-helpers": "^2.2.47",
"@lit-protocol/constants": "^2.2.47",
"@lit-protocol/lit-auth-client": "^2.2.47",
"@lit-protocol/lit-node-client": "^2.2.47",
"@lit-protocol/pkp-client": "^2.2.47",
"@lit-protocol/pkp-ethers": "^2.2.47",
"@lit-protocol/pkp-walletconnect": "^2.2.47",
"@lit-protocol/types": "^2.2.47",
"@sveltejs/vite-plugin-svelte": "^2.4.3",
"@wagmi/core": "^1.3.8",
"@xstate/svelte": "^2.1.0",
"viem": "^1.4.2",
"xstate": "^4.38.2"
}
}

File diff suppressed because it is too large Load Diff

8154
schema.graphql Normal file

File diff suppressed because it is too large Load Diff

15
src/client.ts Normal file
View File

@ -0,0 +1,15 @@
import { HoudiniClient } from '$houdini';
export default new HoudiniClient({
url: 'https://graphql.andert.me/api/graphql'
// uncomment this to configure the network call (for things like authentication)
// for more information, please visit here: https://www.houdinigraphql.com/guides/authentication
// fetchParams({ session }) {
// return {
// headers: {
// Authentication: `Bearer ${session.token}`,
// }
// }
// }
})

View File

@ -0,0 +1,6 @@
query queryTest {
repoGet(owner: "samuelandert.eth", repo: "learn") {
id
name
}
}

View File

@ -1,5 +1,9 @@
<script>
<script lang="ts">
import Composite from '$lib/core/Composite.svelte';
import type { PageData } from './$houdini';
export let data: PageData;
$: ({ queryTest } = data);
let composite = {
id: 'test',
@ -26,4 +30,6 @@
};
</script>
<!-- {JSON.stringify($queryTest.data, null, 2)} -->
<Composite {composite} />

View File

@ -1,14 +1,22 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/kit/vite';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter()
},
ssr: {
// Other SSR options...
dynamicImportShim: false
},
preprocess: vitePreprocess(),
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
alias: {
$houdini: './$houdini',
}
},
ssr: {
// Other SSR options...
dynamicImportShim: false
},
};
export default config;
export default config;

View File

@ -1,24 +1,29 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"types": ["jest", "node"]
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.svelte",
"tests/**/*.ts"
, "tests/provider.test.js" ]
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"types": [
"jest",
"node"
],
"rootDirs": [
".",
"./.svelte-kit/types",
"./$houdini/types"
]
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.svelte",
"tests/**/*.ts",
"tests/provider.test.js"
]
}

View File

@ -1,3 +1,7 @@
import houdini from 'houdini/vite'
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import * as fs from 'fs';
@ -52,6 +56,7 @@ function getRecursiveDataFiles(dir) {
export default defineConfig({
plugins: [
houdini(),
sveltekit(),
{
name: 'components-resolver',
@ -129,4 +134,4 @@ export default defineConfig({
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
});
});