Skip to content

Commit adf90d3

Browse files
authored
Cloudflare adapter (HoudiniGraphql#1155)
1 parent 6b9fbb7 commit adf90d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2204
-754
lines changed

.changeset/empty-eels-destroy-more.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'houdini': patch
3+
---
4+
5+
Add adapter infrastructure when building for production

.changeset/empty-eels-destroy.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'houdini-adapter-cloudflare': patch
3+
'houdini-react': patch
4+
'houdini': patch
5+
---
6+
7+
Add cloudflare adapter

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx pretty-quick@latest --staged
4+
npx lint-staged@latest

e2e/react/houdini.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
/// <references types="houdini-router">
33
/** @type {import('houdini').ConfigFile} */
44
const config = {
5-
schemaPath: '../_api/*.graphql',
5+
watchSchema: {
6+
url: 'https://houdinigraphql.com/graphql',
7+
},
68
defaultPartial: true,
79
scalars: {
810
DateTime: {

e2e/react/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99
"build:web": "pnpm build: && pnpm web",
1010
"build:test": "pnpm build: && pnpm test",
1111
"build:build": "pnpm build: && pnpm build",
12-
"web": "vite ",
13-
"api": "cross-env TZ=utc e2e-api",
14-
"dev": "concurrently \"pnpm run web\" \"pnpm run api\" -n \"web,api\" -c \"green,magenta\"",
12+
"dev": "vite",
1513
"build": "tsc && vite build",
1614
"preview": "vite preview"
1715
},
1816
"dependencies": {
17+
"@cloudflare/kv-asset-handler": "^0.3.0",
18+
"@cloudflare/workers-types": "^4.20230904.0",
19+
"cookie": "^0.5.0",
1920
"houdini": "workspace:^",
21+
"houdini-adapter-cloudflare": "workspace:^",
2022
"houdini-react": "workspace:^",
21-
"react": "^18.2.0",
22-
"react-dom": "^18.2.0",
23+
"itty-router": "^4.0.23",
24+
"react": "^18.3.0-canary-d6dcad6a8-20230914",
25+
"react-dom": "^18.3.0-canary-d6dcad6a8-20230914",
2326
"react-streaming": "^0.3.10"
2427
},
2528
"devDependencies": {
@@ -29,7 +32,9 @@
2932
"concurrently": "7.1.0",
3033
"cross-env": "^7.0.3",
3134
"e2e-api": "workspace:^",
35+
"hono": "^3.6.0",
3236
"typescript": "^4.9.3",
33-
"vite": "^4.1.0"
37+
"vite": "^4.1.0",
38+
"wrangler": "^3.7.0"
3439
}
3540
}

e2e/react/schema.graphql

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
type Link {
2+
name: String
3+
url: String
4+
}
5+
6+
type Mutation {
7+
hello(name: String!): String!
8+
}
9+
10+
type Query {
11+
giveMeAnError: String
12+
links(delai: Int): [Link!]!
13+
sponsors: [Sponsor!]!
14+
welcome: String!
15+
}
16+
17+
type Sponsor {
18+
avatarUrl: String!
19+
login: String!
20+
name: String!
21+
tiersTitle: String!
22+
websiteUrl: String
23+
}

e2e/react/src/+client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { HoudiniClient } from '$houdini'
22

33
// Export the Houdini client
44
export default new HoudiniClient({
5-
url: 'http://localhost:4000/graphql',
5+
url: 'https://houdinigraphql.com/graphql',
66
})

e2e/react/src/routes/+layout.gql

Lines changed: 0 additions & 3 deletions
This file was deleted.

e2e/react/src/routes/+layout.tsx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
import type { LayoutProps } from './$types'
22

3-
export default function ({ HelloRouter, children }: LayoutProps) {
3+
export default function ({ children }: LayoutProps) {
44
return (
55
<div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
6-
message: {HelloRouter.message}
7-
<ul>
8-
<li>
9-
<a href="/">Home</a>
10-
</li>
11-
<li>
12-
<a href="/users/1">Bruce Willis</a>
13-
</li>
14-
<li>
15-
<a href="/users/2">Samuel Jackson</a>
16-
</li>
17-
<li>
18-
<a href="/users/3">Morgan Freeman</a>
19-
</li>
20-
</ul>
6+
Layout!
7+
<div>
8+
<a href="/">Sponsors</a>
9+
<a href="/links">Links</a>
10+
</div>
2111
<div>{children}</div>
2212
</div>
2313
)

e2e/react/src/routes/+page.gql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
query SponsorList {
2+
sponsors {
3+
name
4+
}
5+
}

0 commit comments

Comments
 (0)