Skip to content

Commit 3861147

Browse files
authored
learn — new interactive code blocks (#47)
* Render MiniGraphiQL with `graphiql` string in node.meta * Don't validate in Marked: not its responsibility * Change interactive code snippet colors * Remove global .miniGraphiQL class * Refactor MiniGraphiQL to separate files * Add a TODO comment * Run Playwright on CI * wip * color codemirrors properly * Style codemirrors properly * Upgrade pnpm from 9.15.9 to 10.15.0 * Update 2025 conference schedule and speaker details * Improve syntax highlighting for comments and diffs * Remove focus outline * Extract CodeBlockLabel * Remove unused marked dependency * Rename `marked` to `interactive-code-block` * Update codemirror styles * Allow running esbuild builds * Remove duplicate image * Format * Change syntax theme names to avoid a bug * Fix heights and properly chain handlers * Fix tests for new editor * Run Playwright on CI * Use the same colors for VariableEditor * Use the same font for interactive code blocks * Match the coloring on t.separator [,:] between Lezer and Shiki
1 parent 386df07 commit 3861147

32 files changed

+1366
-1757
lines changed

.github/workflows/check.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ jobs:
2222

2323
- name: Run Prettier Check
2424
run: pnpm format:check
25+
26+
# per the docs: "caching browser binaries is not recommended,
27+
# since the amount of time it takes to restore the cache is
28+
# comparable to the time it takes to download the binaries"
29+
- name: Install Playwright Browsers
30+
run: npx playwright install --with-deps
31+
32+
- name: Run Playwright tests
33+
run: npx playwright test
34+
35+
- uses: actions/upload-artifact@v4
36+
if: ${{ !cancelled() }}
37+
with:
38+
name: playwright-report
39+
path: playwright-report/
40+
retention-days: 30

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ public/sitemap.xml
6363
out/
6464

6565
tsconfig.tsbuildinfo
66+
67+
playwright-report/

package.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"repository": "graphql/graphql.github.io website",
55
"private": true,
6-
"packageManager": "pnpm@9.15.9",
6+
"packageManager": "pnpm@10.15.0",
77
"scripts": {
88
"analyze": "ANALYZE=true next build",
99
"build": "next build && next-image-export-optimizer",
@@ -22,9 +22,17 @@
2222
"validate:snippets": "node scripts/validate-snippets.js"
2323
},
2424
"dependencies": {
25+
"@codemirror/autocomplete": "^6.18.6",
26+
"@codemirror/commands": "^6.3.3",
27+
"@codemirror/lang-json": "^6.0.1",
28+
"@codemirror/language": "^6.10.0",
29+
"@codemirror/lint": "^6.8.5",
30+
"@codemirror/state": "^6.4.0",
31+
"@codemirror/view": "^6.24.0",
2532
"@graphql-tools/schema": "10.0.25",
2633
"@headlessui/react": "^2.2.4",
2734
"@igorkowalczyk/is-browser": "^5.1.0",
35+
"@lezer/highlight": "^1.2.1",
2836
"@next/bundle-analyzer": "^15.4.5",
2937
"@radix-ui/react-radio-group": "^1.2.2",
3038
"@sparticuz/chromium": "^138.0.2",
@@ -34,8 +42,7 @@
3442
"autoprefixer": "^10.4.20",
3543
"calendar-link": "^2.10.0",
3644
"clsx": "^2.1.1",
37-
"codemirror": "^5.65.19",
38-
"codemirror-graphql": "1.3.2",
45+
"cm6-graphql": "^0.2.1",
3946
"date-fns": "^2.30.0",
4047
"fast-glob": "^3.3.3",
4148
"github-slugger": "2.0.0",
@@ -46,9 +53,8 @@
4653
"leaflet": "^1.9.4",
4754
"lucide-react": "^0.469.0",
4855
"markdown-to-jsx": "^7.7.2",
49-
"marked": "5.1.2",
5056
"motion": "^12.11.0",
51-
"next": "^14.2.22",
57+
"next": "^14.2.32",
5258
"next-image-export-optimizer": "^1.18.0",
5359
"next-query-params": "^5.0.1",
5460
"next-sitemap": "^4.2.3",
@@ -88,7 +94,7 @@
8894
"@types/codemirror": "5.60.16",
8995
"@types/hast": "3.0.4",
9096
"@types/node": "^22.10.5",
91-
"@types/react": "^18.3.18",
97+
"@types/react": "^18.3.23",
9298
"@types/rss": "0.0.32",
9399
"@types/string-similarity": "^4.0.2",
94100
"@typescript-eslint/eslint-plugin": "7.18.0",
@@ -106,7 +112,7 @@
106112
"remark-lint-first-heading-level": "3.1.2",
107113
"remark-lint-heading-increment": "3.1.2",
108114
"tsx": "^4.19.4",
109-
"typescript": "^5.8.3"
115+
"typescript": "^5.9.2"
110116
},
111117
"browserslist": [
112118
"chrome >0 and last 2.5 years",
@@ -122,6 +128,9 @@
122128
"nextra": "patches/nextra.patch",
123129
"nextra-theme-docs": "patches/nextra-theme-docs.patch",
124130
"mermaid-isomorphic": "patches/mermaid-isomorphic.patch"
125-
}
131+
},
132+
"onlyBuiltDependencies": [
133+
"esbuild"
134+
]
126135
}
127136
}

0 commit comments

Comments
 (0)