Skip to content

Commit

Permalink
fix for middlewares. Closes graphql#286
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Dec 1, 2017
1 parent 88e88d1 commit f5a6bd7
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 113 deletions.
41 changes: 0 additions & 41 deletions packages/graphql-playground-electron/src/main.ts
Expand Up @@ -27,23 +27,9 @@ app.setAsDefaultProtocolClient('graphql-playground')
const log = {
info: (...args) => {
console.log(...args)
// fs.appendFileSync(
// os.homedir() + '/pg-logs.log',
// JSON.stringify(args) + '\n',
// )
},
}

log.info(protocol)
// log.info(protocol.registerStringProtocol)

// protocol.registerBufferProtocol('graphql-playground', (request, callback) => {
// setTimeout(() => {
// forceSend('OpenUrl', request.url)
// }, 5000)
// callback()
// })

app.on('open-url', (event, url) => {
event.preventDefault()
forceSend('OpenUrl', url)
Expand All @@ -58,33 +44,6 @@ function getFocusedWindow(): any | null {
return BrowserWindow.getFocusedWindow()
}

// function manuallyCheckForUpdates() {
// autoUpdater.on('update-available', () => {
// dialog.showMessageBox(
// {
// type: 'info',
// title: 'Found Updates',
// message: 'Found updates, do you want update now?',
// buttons: ['Sure', 'No'],
// },
// buttonIndex => {
// if (buttonIndex === 0) {
// autoUpdater.downloadUpdate()
// }
// },
// )
// })
//
// autoUpdater.on('update-not-available', () => {
// dialog.showMessageBox({
// title: 'No Updates',
// message: 'Current version is up-to-date.',
// })
// })
//
// autoUpdater.checkForUpdates()
// }

function send(channel: string, arg: string) {
const focusedWindow = getFocusedWindow()
if (focusedWindow) {
Expand Down
@@ -1,6 +1,6 @@
{
"name": "graphql-playground-middleware-express",
"version": "1.3.0",
"version": "1.3.1",
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-express",
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-playground-middleware-hapi/package.json
@@ -1,6 +1,6 @@
{
"name": "graphql-playground-middleware-hapi",
"version": "1.3.0",
"version": "1.3.1",
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-hapi",
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-playground-middleware-koa/package.json
@@ -1,6 +1,6 @@
{
"name": "graphql-playground-middleware-koa",
"version": "1.3.0",
"version": "1.3.1",
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-koa",
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-playground-middleware-lambda/package.json
@@ -1,6 +1,6 @@
{
"name": "graphql-playground-middleware-lambda",
"version": "1.3.0",
"version": "1.3.1",
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-lambada",
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-playground/package.json
@@ -1,6 +1,6 @@
{
"name": "graphql-playground",
"version": "1.3.0",
"version": "1.3.1",
"main": "./lib/lib.js",
"typings": "./lib/lib.d.ts",
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
Expand Down
68 changes: 1 addition & 67 deletions packages/graphql-playground/src/middlewareIndex.tsx
Expand Up @@ -16,74 +16,8 @@ if (process.env.NODE_ENV !== 'production') {
;(window as any)['GraphQLPlayground'] = {
init(element: HTMLElement, options) {
ReactDOM.render(
<MiddlewareApp
// configString={exampleYmlConfig}
// folderName={folderName}
setTitle={true}
showNewWorkspace={false}
env={env}
{...options}
/>,
<MiddlewareApp setTitle={true} showNewWorkspace={false} {...options} />,
element,
)
},
}

// const exampleJsonConfig = `\
// {
// "schemaPath": "schema.graphql",
// "extensions": {
// "endpoints": {
// "prod": {
// "url": "https://airbnb.now.sh",
// "subscription": "wss://airbnb.now.sh"
// },
// "local": {
// "url": "http://localhost:4000",
// "subscription": "ws://localhost:4000"
// }
// }
// }
// }`

// const folderName = `airbnb`

// const exampleYmlConfig = `\
// schemaPath: schema.graphql
// projects:
// privateCluster:
// extensions:
// endpoints:
// default:
// url: 'https://tim.graph.cool/system'
// gateway:
// extensions:
// endpoints:
// default:
// url: 'https://airbnb.now.sh'
// subscription: 'wss://airbnb.now.sh'
// dev:
// url: 'http://localhost:4000'
// subscription: 'ws://localhost:4000'
// database:
// extensions:
// endpoints:
// dev:
// url: 'https://api.graph.cool/simple/v1/\${env:SERVICE_ID}'
// `

// const exampleYmlConfig = `\
// schemaPath: schema.graphql
// extensions:
// endpoints:
// default:
// url: 'https://airbnb.now.sh'
// subscription: 'wss://airbnb.now.sh'
// local:
// url: 'http://localhost:4000'
// subscription: 'ws://localhost:4000'
// `

const env = {
SERVICE_ID: 'asdf',
}

0 comments on commit f5a6bd7

Please sign in to comment.