Skip to content

Commit 8846229

Browse files
hasparusbenjiebignimbusmartinbonnin
authored
landing — interactive editor (#2113)
## Description @martinbonnin proposed making the "How it Works" code samples interactive on Slack. We already had CodeMirror, and I already needed to restyle it for the docs, so it required just a new schema, some refactoring and shuffling things around. I think the idea makes sense, and lets the user experience GraphQL immediately. Even if they're non-programmers, they can maybe get a feel how the data flows and what the experience is like. I changed the section CTA to state "Try GraphiQL", because we're already trying it out live. <img width="1377" height="359" alt="image" src="https://github.com/user-attachments/assets/77bcd251-475c-4aaf-a2c6-9cb6b8e0caad" /> ### To-do - [x] Write a small GraphQL Schema for this example - [x] Double check if next/dynamic worked and we don't have CodeMirror in the main bundle - (I actually wrote `dynamic(import` instead of `dynamic(() => import` initially so it's good I double checked). - [x] Add a test for this --------- Co-authored-by: Benjie <benjie@jemjie.com> Co-authored-by: Jeff Auriemma <bignimbus@users.noreply.github.com> Co-authored-by: Martin Bonnin <martin@mbonnin.net>
1 parent 90cefbc commit 8846229

File tree

144 files changed

+46777
-345
lines changed

Some content is hidden

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

144 files changed

+46777
-345
lines changed

.github/workflows/check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
- name: Run Playwright tests
5050
run: ./node_modules/.bin/playwright test
5151

52+
- name: Run unit tests
53+
run: pnpm test:unit
54+
5255
- uses: actions/upload-artifact@v4
5356
if: ${{ !cancelled() }}
5457
with:

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const ALLOWED_SVG_REGEX = new RegExp(`${sep}icons${sep}.+\\.svg$`)
3535
* @type {import('next').NextConfig}
3636
*/
3737
const config = {
38+
output: undefined,
3839
// reactStrictMode: true, provoke duplicated codemirror editors
3940
webpack(config) {
4041
// #region MDX

package.json

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint:docs": "eslint --ignore-path .gitignore src/pages/learn --format stylish",
1616
"lint:docs:ci": "eslint --ignore-path .gitignore src/pages/learn --format eslint-formatter-github",
1717
"postbuild": "next-sitemap",
18-
"prebuild": "tsx scripts/get-github-info",
18+
"prebuild": "tsx scripts/get-github-info && tsx scripts/sync-landing-schema/src/index.ts",
1919
"start": "next start",
2020
"test": "playwright test && pnpm test:unit",
2121
"test:e2e": "playwright test",
@@ -25,17 +25,17 @@
2525
},
2626
"dependencies": {
2727
"@base-ui-components/react": "1.0.0-beta.4",
28-
"@codemirror/autocomplete": "^6.18.6",
29-
"@codemirror/commands": "^6.3.3",
30-
"@codemirror/language": "^6.10.0",
31-
"@codemirror/lint": "^6.8.5",
32-
"@codemirror/state": "^6.4.0",
33-
"@codemirror/view": "^6.24.0",
34-
"@graphql-tools/schema": "10.0.26",
28+
"@codemirror/autocomplete": "6.18.6",
29+
"@codemirror/commands": "6.3.3",
30+
"@codemirror/language": "6.10.0",
31+
"@codemirror/lint": "6.8.5",
32+
"@codemirror/state": "6.4.0",
33+
"@codemirror/view": "6.24.0",
34+
"@graphql-tools/schema": "10.0.25",
3535
"@hasparus/lezer-json-shikified": "1.1.3",
3636
"@headlessui/react": "^2.2.4",
3737
"@igorkowalczyk/is-browser": "^5.1.0",
38-
"@lezer/highlight": "^1.2.1",
38+
"@lezer/highlight": "1.2.1",
3939
"@next/bundle-analyzer": "^15.4.5",
4040
"@plaiceholder/next": "^3.0.0",
4141
"@sparticuz/chromium": "^138.0.2",
@@ -92,6 +92,7 @@
9292
},
9393
"devDependencies": {
9494
"@graphql-eslint/eslint-plugin": "4.4.0",
95+
"@graphql-eslint/parser": "^0.1.0",
9596
"@next/eslint-plugin-next": "^15.3.3",
9697
"@playwright/test": "^1.54.2",
9798
"@svgr/webpack": "^8.1.0",
@@ -140,6 +141,16 @@
140141
"esbuild",
141142
"iframe-resizer",
142143
"sharp"
143-
]
144+
],
145+
"overrides": {
146+
"@lezer/highlight": "1.2.1",
147+
"@lezer/common": "1.2.3",
148+
"@codemirror/autocomplete": "6.18.6",
149+
"@codemirror/commands": "6.3.3",
150+
"@codemirror/language": "6.10.0",
151+
"@codemirror/lint": "6.8.5",
152+
"@codemirror/state": "6.4.0",
153+
"@codemirror/view": "6.24.0"
154+
}
144155
}
145156
}

0 commit comments

Comments
 (0)