Skip to content

Commit b0a7cb5

Browse files
committed
Make graphqlconfig optional. Closes #311
1 parent 8c49bf0 commit b0a7cb5

File tree

11 files changed

+65
-74
lines changed

11 files changed

+65
-74
lines changed

packages/graphql-playground-html/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-playground-html",
3-
"version": "1.3.5",
3+
"version": "1.3.6",
44
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-html",
55
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
66
"contributors": [

packages/graphql-playground-html/src/render-playground-page.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,36 @@ export interface RenderPageOptions extends MiddlewareOptions {
2020
env?: any
2121
}
2222

23-
const config = getGraphQLConfig().config
24-
const configPath = findGraphQLConfigFile(process.cwd())
25-
const configString = fs.readFileSync(configPath, 'utf-8')
26-
const folderName = path.basename(process.cwd())
27-
const env = getUsedEnvs(config)
28-
2923
const loading = getLoadingMarkup()
3024

3125
export function renderPlaygroundPage(options: RenderPageOptions) {
26+
let config
27+
let configPath
28+
let configString
29+
let folderName
30+
let env
31+
try {
32+
config = getGraphQLConfig().config
33+
configPath = findGraphQLConfigFile(process.cwd())
34+
configString = fs.readFileSync(configPath, 'utf-8')
35+
folderName = path.basename(process.cwd())
36+
env = getUsedEnvs(config)
37+
} catch (e) {
38+
//
39+
}
3240
const extendedOptions = {
3341
...options,
3442
configString,
3543
folderName,
3644
canSaveConfig: false,
3745
env,
3846
}
47+
if (!extendedOptions.endpoint && !extendedOptions.configString) {
48+
/* tslint:disable-next-line */
49+
console.warn(
50+
`WARNING: You didn't provide an endpoint and don't have a .graphqlconfig. Make sure you have at least one of them.`,
51+
)
52+
}
3953
return `
4054
<!DOCTYPE html>
4155
<html>

packages/graphql-playground-middleware-express/package.json

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"name": "graphql-playground-middleware-express",
3-
"version": "1.3.5",
4-
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-express",
5-
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
3+
"version": "1.3.6",
4+
"homepage":
5+
"https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-express",
6+
"description":
7+
"GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
68
"contributors": [
79
"Tim Suchanek <[email protected]>",
810
"Johannes Schickling <[email protected]>",
@@ -11,19 +13,12 @@
1113
"repository": "http://github.com/graphcool/graphql-playground.git",
1214
"license": "SEE LICENSE IN LICENSE",
1315
"main": "dist/index.js",
14-
"files": [
15-
"dist"
16-
],
16+
"files": ["dist"],
1717
"scripts": {
1818
"build": "tsc",
1919
"prepublishOnly": "npm run build"
2020
},
21-
"keywords": [
22-
"graphql",
23-
"graphiql",
24-
"playground",
25-
"graphcool"
26-
],
21+
"keywords": ["graphql", "graphiql", "playground", "graphcool"],
2722
"peerDependencies": {
2823
"express": "^4.16.2"
2924
},
@@ -32,7 +27,7 @@
3227
"typescript": "^2.6.1"
3328
},
3429
"dependencies": {
35-
"graphql-playground-html": "^1.3.5",
30+
"graphql-playground-html": "^1.3.6",
3631
"graphql-playground-middleware": "^1.2.1-beta.6"
3732
},
3833
"typings": "dist/index.d.ts",

packages/graphql-playground-middleware-express/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ graphql-config@^1.0.9:
7575
minimatch "^3.0.4"
7676
rimraf "^2.6.2"
7777

78-
graphql-playground-html@^1.3.5:
79-
version "1.3.5"
80-
resolved "https://registry.yarnpkg.com/graphql-playground-html/-/graphql-playground-html-1.3.5.tgz#962ea7b39682e2285712feb481ff06ea560cf900"
78+
graphql-playground-html@^1.3.6:
79+
version "1.3.6"
80+
resolved "https://registry.yarnpkg.com/graphql-playground-html/-/graphql-playground-html-1.3.6.tgz#3db97d5d7e7123cf62a86820b0be5d4b4092af4a"
8181
dependencies:
8282
graphql-config "^1.0.9"
8383

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"name": "graphql-playground-middleware-hapi",
3-
"version": "1.3.5",
4-
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-hapi",
5-
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
3+
"version": "1.3.6",
4+
"homepage":
5+
"https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-hapi",
6+
"description":
7+
"GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
68
"contributors": [
79
"Tim Suchanek <[email protected]>",
810
"Johannes Schickling <[email protected]>",
@@ -11,20 +13,12 @@
1113
"repository": "http://github.com/graphcool/graphql-playground.git",
1214
"license": "SEE LICENSE IN LICENSE",
1315
"main": "dist/index.js",
14-
"files": [
15-
"dist"
16-
],
16+
"files": ["dist"],
1717
"scripts": {
1818
"build": "tsc",
1919
"prepublishOnly": "npm run build"
2020
},
21-
"keywords": [
22-
"graphql",
23-
"graphiql",
24-
"playground",
25-
"graphcool",
26-
"hapi"
27-
],
21+
"keywords": ["graphql", "graphiql", "playground", "graphcool", "hapi"],
2822
"peerDependencies": {
2923
"hapi": "^16.6.2"
3024
},
@@ -37,7 +31,7 @@
3731
"definition": "dist/index.d.ts"
3832
},
3933
"dependencies": {
40-
"graphql-playground-html": "^1.3.5",
34+
"graphql-playground-html": "^1.3.6",
4135
"graphql-playground-middleware": "^1.2.1-beta.6"
4236
}
4337
}

packages/graphql-playground-middleware-hapi/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ graphql-config@^1.0.9:
7575
minimatch "^3.0.4"
7676
rimraf "^2.6.2"
7777

78-
graphql-playground-html@^1.3.5:
79-
version "1.3.5"
80-
resolved "https://registry.yarnpkg.com/graphql-playground-html/-/graphql-playground-html-1.3.5.tgz#962ea7b39682e2285712feb481ff06ea560cf900"
78+
graphql-playground-html@^1.3.6:
79+
version "1.3.6"
80+
resolved "https://registry.yarnpkg.com/graphql-playground-html/-/graphql-playground-html-1.3.6.tgz#3db97d5d7e7123cf62a86820b0be5d4b4092af4a"
8181
dependencies:
8282
graphql-config "^1.0.9"
8383

packages/graphql-playground-middleware-koa/package.json

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"name": "graphql-playground-middleware-koa",
3-
"version": "1.3.5",
4-
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-koa",
5-
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
3+
"version": "1.3.6",
4+
"homepage":
5+
"https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-koa",
6+
"description":
7+
"GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
68
"contributors": [
79
"Tim Suchanek <[email protected]>",
810
"Johannes Schickling <[email protected]>",
@@ -11,20 +13,12 @@
1113
"repository": "http://github.com/graphcool/graphql-playground.git",
1214
"license": "SEE LICENSE IN LICENSE",
1315
"main": "dist/index.js",
14-
"files": [
15-
"dist"
16-
],
16+
"files": ["dist"],
1717
"scripts": {
1818
"build": "tsc",
1919
"prepublishOnly": "npm run build"
2020
},
21-
"keywords": [
22-
"graphql",
23-
"graphiql",
24-
"playground",
25-
"graphcool",
26-
"koa"
27-
],
21+
"keywords": ["graphql", "graphiql", "playground", "graphcool", "koa"],
2822
"peerDependencies": {
2923
"koa": "^2.3.0"
3024
},
@@ -37,7 +31,7 @@
3731
"definition": "dist/index.d.ts"
3832
},
3933
"dependencies": {
40-
"graphql-playground-html": "^1.3.5",
34+
"graphql-playground-html": "^1.3.6",
4135
"graphql-playground-middleware": "^1.2.1-beta.6",
4236
"koa": "^2.4.1"
4337
}

packages/graphql-playground-middleware-koa/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ graphql-config@^1.0.9:
143143
minimatch "^3.0.4"
144144
rimraf "^2.6.2"
145145

146-
graphql-playground-html@^1.3.5:
147-
version "1.3.5"
148-
resolved "https://registry.yarnpkg.com/graphql-playground-html/-/graphql-playground-html-1.3.5.tgz#962ea7b39682e2285712feb481ff06ea560cf900"
146+
graphql-playground-html@^1.3.6:
147+
version "1.3.6"
148+
resolved "https://registry.yarnpkg.com/graphql-playground-html/-/graphql-playground-html-1.3.6.tgz#3db97d5d7e7123cf62a86820b0be5d4b4092af4a"
149149
dependencies:
150150
graphql-config "^1.0.9"
151151

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"name": "graphql-playground-middleware-lambda",
3-
"version": "1.3.5",
4-
"homepage": "https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-lambada",
5-
"description": "GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
3+
"version": "1.3.6",
4+
"homepage":
5+
"https://github.com/graphcool/graphql-playground/tree/master/packages/graphql-playground-middleware-lambada",
6+
"description":
7+
"GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).",
68
"contributors": [
79
"Tim Suchanek <[email protected]>",
810
"Johannes Schickling <[email protected]>",
@@ -11,20 +13,12 @@
1113
"repository": "http://github.com/graphcool/graphql-playground.git",
1214
"license": "SEE LICENSE IN LICENSE",
1315
"main": "dist/index.js",
14-
"files": [
15-
"dist"
16-
],
16+
"files": ["dist"],
1717
"scripts": {
1818
"build": "tsc",
1919
"prepublishOnly": "npm run build"
2020
},
21-
"keywords": [
22-
"graphql",
23-
"graphiql",
24-
"playground",
25-
"graphcool",
26-
"lambada"
27-
],
21+
"keywords": ["graphql", "graphiql", "playground", "graphcool", "lambada"],
2822
"peerDependencies": {
2923
"aws-lambda": "^0.1.2"
3024
},
@@ -37,7 +31,7 @@
3731
"definition": "dist/index.d.ts"
3832
},
3933
"dependencies": {
40-
"graphql-playground-html": "^1.3.5",
34+
"graphql-playground-html": "^1.3.6",
4135
"graphql-playground-middleware": "^1.2.1-beta.6"
4236
}
4337
}

0 commit comments

Comments
 (0)