Skip to content

Commit 9b83366

Browse files
committed
build: remove fetching of graphiql
- Randomly generates 429 too many request errors - use a local copy of index.html
1 parent 06de247 commit 9b83366

File tree

2 files changed

+112
-20
lines changed

2 files changed

+112
-20
lines changed

modules/jooby-graphiql/pom.xml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,26 @@
5858
<!-- </execution>-->
5959
<!-- </executions>-->
6060
<!-- </plugin>-->
61-
<plugin>
62-
<groupId>org.apache.maven.plugins</groupId>
63-
<artifactId>maven-antrun-plugin</artifactId>
64-
<version>${maven-antrun-plugin.version}</version>
65-
<executions>
66-
<execution>
67-
<goals>
68-
<goal>run</goal>
69-
</goals>
70-
<phase>generate-resources</phase>
71-
<configuration>
72-
<target>
73-
<property name="output" value="${project.build.outputDirectory}${file.separator}io${file.separator}jooby${file.separator}graphiql"/>
74-
<mkdir dir="${output}" />
75-
<get quiet="true" usetimestamp="true" src="https://raw.githubusercontent.com/graphql/graphiql/refs/heads/main/examples/graphiql-cdn/index.html" dest="${output}${file.separator}index.html"/>
76-
</target>
77-
</configuration>
78-
</execution>
79-
</executions>
80-
</plugin>
61+
<!-- <plugin>-->
62+
<!-- <groupId>org.apache.maven.plugins</groupId>-->
63+
<!-- <artifactId>maven-antrun-plugin</artifactId>-->
64+
<!-- <version>${maven-antrun-plugin.version}</version>-->
65+
<!-- <executions>-->
66+
<!-- <execution>-->
67+
<!-- <goals>-->
68+
<!-- <goal>run</goal>-->
69+
<!-- </goals>-->
70+
<!-- <phase>generate-resources</phase>-->
71+
<!-- <configuration>-->
72+
<!-- <target>-->
73+
<!-- <property name="output" value="${project.build.outputDirectory}${file.separator}io${file.separator}jooby${file.separator}graphiql"/>-->
74+
<!-- <mkdir dir="${output}" />-->
75+
<!-- <get quiet="true" usetimestamp="true" src="https://raw.githubusercontent.com/graphql/graphiql/refs/heads/main/examples/graphiql-cdn/index.html" dest="${output}${file.separator}index.html"/>-->
76+
<!-- </target>-->
77+
<!-- </configuration>-->
78+
<!-- </execution>-->
79+
<!-- </executions>-->
80+
<!-- </plugin>-->
8181
</plugins>
8282
</build>
8383
</project>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<!--
2+
* Copyright (c) 2025 GraphQL Contributors
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
-->
8+
<!doctype html>
9+
<html lang="en">
10+
<head>
11+
<meta charset="UTF-8" />
12+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
13+
<title>GraphiQL 5 with React 19 and GraphiQL Explorer</title>
14+
<style>
15+
body {
16+
margin: 0;
17+
}
18+
19+
#graphiql {
20+
height: 100dvh;
21+
}
22+
23+
.loading {
24+
height: 100%;
25+
display: flex;
26+
align-items: center;
27+
justify-content: center;
28+
font-size: 4rem;
29+
}
30+
</style>
31+
<link rel="stylesheet" href="https://esm.sh/graphiql/dist/style.css" />
32+
<link
33+
rel="stylesheet"
34+
href="https://esm.sh/@graphiql/plugin-explorer/dist/style.css"
35+
/>
36+
<!--
37+
* Note:
38+
* The ?standalone flag bundles the module along with all of its `dependencies`, excluding `peerDependencies`, into a single JavaScript file.
39+
* `@emotion/is-prop-valid` is a shim to remove the console error ` module "@emotion /is-prop-valid" not found`. Upstream issue: https://github.com/motiondivision/motion/issues/3126
40+
-->
41+
<script type="importmap">
42+
{
43+
"imports": {
44+
"react": "https://esm.sh/[email protected]",
45+
"react/": "https://esm.sh/[email protected]/",
46+
47+
"react-dom": "https://esm.sh/[email protected]",
48+
"react-dom/": "https://esm.sh/[email protected]/",
49+
50+
"graphiql": "https://esm.sh/graphiql?standalone&external=react,react-dom,@graphiql/react,graphql",
51+
"graphiql/": "https://esm.sh/graphiql/",
52+
"@graphiql/plugin-explorer": "https://esm.sh/@graphiql/plugin-explorer?standalone&external=react,@graphiql/react,graphql",
53+
"@graphiql/react": "https://esm.sh/@graphiql/react?standalone&external=react,react-dom,graphql,@graphiql/toolkit,@emotion/is-prop-valid",
54+
55+
"@graphiql/toolkit": "https://esm.sh/@graphiql/toolkit?standalone&external=graphql",
56+
"graphql": "https://esm.sh/[email protected]",
57+
"@emotion/is-prop-valid": "data:text/javascript,"
58+
}
59+
}
60+
</script>
61+
<script type="module">
62+
import React from 'react';
63+
import ReactDOM from 'react-dom/client';
64+
import { GraphiQL, HISTORY_PLUGIN } from 'graphiql';
65+
import { createGraphiQLFetcher } from '@graphiql/toolkit';
66+
import { explorerPlugin } from '@graphiql/plugin-explorer';
67+
import 'graphiql/setup-workers/esm.sh';
68+
69+
const fetcher = createGraphiQLFetcher({
70+
url: 'https://countries.trevorblades.com',
71+
});
72+
const plugins = [HISTORY_PLUGIN, explorerPlugin()];
73+
74+
function App() {
75+
return React.createElement(GraphiQL, {
76+
fetcher,
77+
plugins,
78+
defaultEditorToolsVisibility: true,
79+
});
80+
}
81+
82+
const container = document.getElementById('graphiql');
83+
const root = ReactDOM.createRoot(container);
84+
root.render(React.createElement(App));
85+
</script>
86+
</head>
87+
<body>
88+
<div id="graphiql">
89+
<div class="loading">Loading…</div>
90+
</div>
91+
</body>
92+
</html>

0 commit comments

Comments
 (0)