-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify Next.js example + add symlinks to React Vite to maintain 2 e…
…xamples from 1 place (#3281)
- Loading branch information
1 parent
e54f7d9
commit 0adffc2
Showing
33 changed files
with
780 additions
and
622 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
## GraphiQL `create-react-app` Example | ||
# GraphiQL `create-react-app` Example | ||
|
||
This example demonstrates how to transpile your own custom ES6 and typescript GraphiQL implementation bootstrapped with `create-react-app`, no config needed. | ||
|
||
### Setup | ||
## Setup | ||
|
||
1. `yarn` and `yarn start` from this folder to start `react-scripts` dev server. | ||
1. `yarn build` from this folder to build production ready transpiled files using `react-scripts`. Find the output in `build` folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
import React from 'react'; | ||
import GraphiQL from 'graphiql'; | ||
import { GraphiQL } from 'graphiql'; | ||
import type { Fetcher } from '@graphiql/toolkit'; | ||
import 'graphiql/graphiql.min.css'; | ||
|
||
const App = () => ( | ||
<GraphiQL | ||
fetcher={async graphQLParams => { | ||
const data = await fetch( | ||
'https://swapi-graphql.netlify.app/.netlify/functions/index', | ||
{ | ||
method: 'POST', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(graphQLParams), | ||
credentials: 'same-origin', | ||
}, | ||
); | ||
return data.json().catch(() => data.text()); | ||
}} | ||
/> | ||
); | ||
const fetcher: Fetcher = async graphQLParams => { | ||
const data = await fetch( | ||
'https://swapi-graphql.netlify.app/.netlify/functions/index', | ||
{ | ||
method: 'POST', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(graphQLParams), | ||
credentials: 'same-origin', | ||
}, | ||
); | ||
return data.json().catch(() => data.text()); | ||
}; | ||
|
||
const App = () => <GraphiQL fetcher={fetcher} />; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
.next | ||
.next/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
{ | ||
"name": "next-monaco-example", | ||
"version": "0.1.0", | ||
"name": "example-monaco-graphql-nextjs", | ||
"version": "0.0.0", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "next dev", | ||
"dev": "next", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
"start": "next start" | ||
}, | ||
"dependencies": { | ||
"@graphiql/toolkit": "^0.8.0", | ||
"@types/node": "18.13.0", | ||
"@types/react": "18.0.28", | ||
"@types/react-dom": "18.0.11", | ||
"eslint": "8.34.0", | ||
"eslint-config-next": "13.1.6", | ||
"prettier": "3.0.0-alpha.12", | ||
"@graphiql/toolkit": "^0.8.4", | ||
"graphql": "^16.6.0", | ||
"graphql-ws": "^5.11.3", | ||
"graphql-ws": "^5.5.5", | ||
"jsonc-parser": "^3.2.0", | ||
"marked": "^4.2.12", | ||
"monaco-editor": "^0.35.0", | ||
"monaco-editor": "^0.39.0", | ||
"monaco-editor-webpack-plugin": "^7.0.1", | ||
"monaco-graphql": "^1.1.7", | ||
"next": "13.1.6", | ||
"next-global-css": "^1.3.1", | ||
"prettier": "^2.8.4", | ||
"monaco-graphql": "^1.2.4", | ||
"next": "13.4.7", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"typescript": "4.9.5" | ||
"react-dom": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "18.16.18", | ||
"@types/react": "18.2.14", | ||
"next-global-css": "1.3.1", | ||
"typescript": "5.1.3" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.