From f9ffccf309b2379e70245da9de7b426e489a9967 Mon Sep 17 00:00:00 2001 From: Sukhpal Saini Date: Fri, 11 Oct 2019 16:00:14 +0000 Subject: [PATCH 1/6] add deply oto heroku button --- Procfile | 1 + app.json | 10 ++++++++++ example/README.md | 2 ++ package.json | 3 ++- 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 Procfile create mode 100644 app.json diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..057cdbbd --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: npm start --prefix example diff --git a/app.json b/app.json new file mode 100644 index 00000000..f79ffaa2 --- /dev/null +++ b/app.json @@ -0,0 +1,10 @@ +{ + "name": "graphql-voyager-example", + "description": "GraphQL introspection viewer example", + "website": "https://github.com/APIs-guru/graphql-voyager.git", + "buildpacks": [ + { + "url": "heroku/nodejs" + } + ] +} diff --git a/example/README.md b/example/README.md index 04db2412..3a3e20fa 100644 --- a/example/README.md +++ b/example/README.md @@ -1,6 +1,8 @@ Example GraphQL-Voyager Install ======================== +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) + ------ **Attribution:** the contents of this folder was copied from [GraphiQL](https://github.com/graphql/graphiql/tree/master/example) example and modified for GraphQL-Voyager example. See copyright below: diff --git a/package.json b/package.json index 5d4cffc2..f8fc5434 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "deploy": "deploy-to-gh-pages --local --update demo-dist", "stats": "NODE_ENV=production webpack --json --mode=production --config build/webpack.js > stats.json", "prettier": "prettier --write \"{,!(node_modules)/**/}*.{ts,tsx}\"", - "declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json" + "declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json", + "postinstall": "cd example && npm install" }, "license": "MIT", "devDependencies": { From 175043b846bd70509956d932bee198572d0e7e92 Mon Sep 17 00:00:00 2001 From: Sukhpal Saini Date: Fri, 11 Oct 2019 16:13:30 +0000 Subject: [PATCH 2/6] update example README --- app.json | 1 + example/README.md | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app.json b/app.json index f79ffaa2..30df4a90 100644 --- a/app.json +++ b/app.json @@ -2,6 +2,7 @@ "name": "graphql-voyager-example", "description": "GraphQL introspection viewer example", "website": "https://github.com/APIs-guru/graphql-voyager.git", + "repository": "https://github.com/bdcorps/graphql-voyager/tree/master/", "buildpacks": [ { "url": "heroku/nodejs" diff --git a/example/README.md b/example/README.md index 3a3e20fa..54d037a6 100644 --- a/example/README.md +++ b/example/README.md @@ -1,10 +1,8 @@ Example GraphQL-Voyager Install ======================== -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) - ------ -**Attribution:** the contents of this folder was copied from [GraphiQL](https://github.com/graphql/graphiql/tree/master/example) example and modified for GraphQL-Voyager example. See copyright below: +**Attribution:** The contents of this folder were copied from [GraphiQL](https://github.com/graphql/graphiql/tree/master/example) example and modified for GraphQL-Voyager example. See copyright below: > Copyright (c) Facebook, Inc. All rights reserved. [LICENSE](https://github.com/graphql/graphiql/blob/master/LICENSE) @@ -15,8 +13,14 @@ than depending on npm, so that it is easier to test new changes. In order to use the compiled version of GraphQL-Voyager, first run in the parent directory before installing and starting the example. +## Running Locally + 1. Run `npm install && npm run build:release` in the parent directory 2. Navigate to this directory (example) in Terminal 3. `npm install` 4. `npm start` 5. Open your browser to the address listed in your console. e.g. `Started on http://localhost:49811/` + +## Running on Cloud + +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) From 8b92523e7eac46c93ee8f85d726a47116084d4fb Mon Sep 17 00:00:00 2001 From: Sukhpal Saini Date: Fri, 11 Oct 2019 16:15:44 +0000 Subject: [PATCH 3/6] update repository app.json --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 30df4a90..4af55ba2 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "name": "graphql-voyager-example", "description": "GraphQL introspection viewer example", "website": "https://github.com/APIs-guru/graphql-voyager.git", - "repository": "https://github.com/bdcorps/graphql-voyager/tree/master/", + "repository": "https://github.com/bdcorps/graphql-voyager/tree/9-deploy-to-heroku/", "buildpacks": [ { "url": "heroku/nodejs" From 3fe2c80e49ce53a6f4e768c9e279e09790ef56fa Mon Sep 17 00:00:00 2001 From: Sukhpal Saini Date: Fri, 11 Oct 2019 16:20:15 +0000 Subject: [PATCH 4/6] remove repository from app.json --- README.md | 3 +++ app.json | 1 - example/README.md | 4 ---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ccc2b290..2d85af6b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ _[GraphQL Weekly #42](https://graphqlweekly.com/issues/42)_ ## [Live Demo](https://apis.guru/graphql-voyager/) [![voyager demo](./docs/demo-gif.gif)](https://apis.guru/graphql-voyager/) +## Running on Cloud +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) + ## Features + Quick navigation on graph + Left panel which provides more detailed information about every type diff --git a/app.json b/app.json index 4af55ba2..f79ffaa2 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,6 @@ "name": "graphql-voyager-example", "description": "GraphQL introspection viewer example", "website": "https://github.com/APIs-guru/graphql-voyager.git", - "repository": "https://github.com/bdcorps/graphql-voyager/tree/9-deploy-to-heroku/", "buildpacks": [ { "url": "heroku/nodejs" diff --git a/example/README.md b/example/README.md index 54d037a6..a6d453f7 100644 --- a/example/README.md +++ b/example/README.md @@ -20,7 +20,3 @@ installing and starting the example. 3. `npm install` 4. `npm start` 5. Open your browser to the address listed in your console. e.g. `Started on http://localhost:49811/` - -## Running on Cloud - -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) From 101aa49393676fa5dd0f2b51b34e939a87fda93d Mon Sep 17 00:00:00 2001 From: Sukhpal Saini Date: Fri, 11 Oct 2019 16:24:50 +0000 Subject: [PATCH 5/6] update example server to use ENV PORT --- example/server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/example/server.js b/example/server.js index 9fe2732d..53343b43 100644 --- a/example/server.js +++ b/example/server.js @@ -3,11 +3,13 @@ const graphqlHTTP = require('express-graphql'); const schema = require('./schema'); +var port = process.env.PORT || process.env.VCAP_APP_PORT || 3005; + const app = express(); app.use(express.static(__dirname)); app.use('/graphql', graphqlHTTP(() => ({ schema }))); -app.listen(0, function() { - const port = this.address().port; + +app.listen(port, function() { console.log(`Started on http://localhost:${port}/`); }); From 0fe10c8794448f20ceb397aa769260de1bd5b67f Mon Sep 17 00:00:00 2001 From: Sukhpal Saini Date: Fri, 11 Oct 2019 16:32:03 +0000 Subject: [PATCH 6/6] add heroku button URL --- README.md | 3 --- example/README.md | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2d85af6b..ccc2b290 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,6 @@ _[GraphQL Weekly #42](https://graphqlweekly.com/issues/42)_ ## [Live Demo](https://apis.guru/graphql-voyager/) [![voyager demo](./docs/demo-gif.gif)](https://apis.guru/graphql-voyager/) -## Running on Cloud -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) - ## Features + Quick navigation on graph + Left panel which provides more detailed information about every type diff --git a/example/README.md b/example/README.md index a6d453f7..b72a137e 100644 --- a/example/README.md +++ b/example/README.md @@ -20,3 +20,7 @@ installing and starting the example. 3. `npm install` 4. `npm start` 5. Open your browser to the address listed in your console. e.g. `Started on http://localhost:49811/` + +## Running on Cloud + +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/bdcorps/graphql-voyager/tree/9-deploy-to-heroku)