Skip to content

Commit

Permalink
Try moving to netlify edge
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorblades committed Dec 27, 2023
1 parent b915685 commit 91338b8
Show file tree
Hide file tree
Showing 8 changed files with 7,162 additions and 105 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
node_modules

# Local Netlify folder
.netlify

yarn-error.log
17 changes: 12 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"eslint.validate": [
"javascript",
"typescript",
"graphql"
]
"eslint.validate": [
"javascript",
"typescript",
"graphql"
],
"deno.enable": true,
"deno.enablePaths": [
"netlify/edge-functions"
],
"deno.unstable": true,
"deno.importMap": ".netlify/edge-functions-import-map.json",
"deno.path": "/Users/trevorblades/Library/Preferences/netlify/deno-cli/deno"
}
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[edge_functions]]
function = "graphql"
path = "/graphql"
3 changes: 3 additions & 0 deletions netlify/edge-functions/graphql.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import yoga from "../../src/graphql.ts";

export default yoga;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"start": "wrangler dev",
"dev": "wrangler dev",
"deploy": "wrangler publish",
"test": "jest"
},
Expand All @@ -21,6 +21,7 @@
"devDependencies": {
"@cloudflare/workers-types": "^4.20230404.0",
"@graphql-tools/executor-http": "^0.1.9",
"@netlify/edge-functions": "^2.2.0",
"@trevorblades/eslint-plugin": "^1.2.3",
"@types/iso-3166-2": "^1.0.0",
"@types/jest": "^29.5.0",
Expand All @@ -29,6 +30,7 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"netlify-cli": "^17.10.1",
"prettier": "2.7.1",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
Expand Down
8 changes: 2 additions & 6 deletions src/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { createYoga } from "graphql-yoga";
import { schema } from "./schema";
import { schema } from "./schema.ts";

export const yoga = createYoga({ schema });

export default {
fetch: yoga.fetch,
};
export default createYoga({ schema });
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"esModuleInterop": true,
"isolatedModules": true,
"strict": true,
"resolveJsonModule": true
"resolveJsonModule": true,
"allowImportingTsExtensions": true
}
}
7,224 changes: 7,132 additions & 92 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 91338b8

Please sign in to comment.