Closes #6855: Bundle and locally serve GraphiQL JS/CSS

This commit is contained in:
checktheroads
2021-07-31 23:49:48 -07:00
parent 80836c725c
commit 08ed545065
10 changed files with 645 additions and 24 deletions
@@ -0,0 +1,3 @@
// Rather than use CDNs to include GraphiQL dependencies, import and bundle the dependencies so
// they can be locally served.
@import '../node_modules/graphiql/graphiql.css';
@@ -0,0 +1,17 @@
/**
* Rather than use CDNs to include GraphiQL dependencies, import and bundle the dependencies so
* they can be locally served.
*/
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import 'graphql';
import GraphiQL from 'graphiql';
import SubscriptionsTransportWs from 'subscriptions-transport-ws';
window.React = React;
window.ReactDOM = ReactDOM;
// @ts-expect-error Assigning to window is required for graphene-django
window.SubscriptionsTransportWs = SubscriptionsTransportWs;
// @ts-expect-error Assigning to window is required for graphene-django
window.GraphiQL = GraphiQL;
@@ -0,0 +1,16 @@
{
"name": "netbox-graphiql",
"version": "0.1.0",
"description": "NetBox GraphiQL Custom Front End",
"main": "dist/graphiql.js",
"license": "Apache-2.0",
"private": true,
"dependencies": {
"graphiql": "1.4.1",
"graphql": ">= v14.5.0 <= 15.5.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"subscriptions-transport-ws": "0.9.18",
"whatwg-fetch": "3.6.2"
}
}