Skip to content

Commit 400bb4d

Browse files
authored
Create interactive GraphQL visual tool [Fixes PalisadoesFoundation#1243] (PalisadoesFoundation#1245)
* Add Voyager * Fix dependencies issues * Move documentation * Move vogayer to only dev env
1 parent c75c1ee commit 400bb4d

File tree

5 files changed

+1697
-1044
lines changed

5 files changed

+1697
-1044
lines changed

CONTRIBUTING.md

+39-25
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ If you are new to contributing to open source, please read the Open Source Guide
1717
- [Conflict Resolution](#conflict-resolution)
1818
- [Contributing Code](#contributing-code)
1919
- [Upgrading Code](#upgrading-code)
20-
- [Setting up Upstream and Origin](#setting-up-upstream-and-origin)
21-
- [Creating a Pull Request - Process Overview](#creating-a-pull-request---process-overview)
20+
- [Setting up Upstream and Origin](#setting-up-upstream-and-origin)
21+
- [Creating a Pull Request - Process Overview](#creating-a-pull-request---process-overview)
2222
- [Type checking and code quality](#type-checking-and-code-quality)
23-
- [Type checking code files](#type-checking-code-files)
24-
- [Linting code files](#linting-code-files)
25-
- [Formatting code files](#formatting-code-files)
26-
- [Automation using husky](#automation-using-husky)
27-
- [Running Queries with talawa-api](#running-queries-with-talawa-api)
23+
- [Type checking code files](#type-checking-code-files)
24+
- [Linting code files](#linting-code-files)
25+
- [Formatting code files](#formatting-code-files)
26+
- [Automation using husky](#automation-using-husky)
27+
- [Pre-Commit hook](#pre-commit-hook)
28+
- [Post-Merge hook](#post-merge-hook)
29+
- [GraphQL Voyager](#graphql-voyager)
30+
- [Running Queries with talawa-api](#running-queries-with-talawa-api)
2831
- [Internships](#internships)
2932
- [Community](#community)
3033

@@ -77,7 +80,7 @@ When multiple developers are working on issues there is bound to be a conflict o
7780
- In the cases where you feel your potential issues could be an extension or in conflict with other PRs it is important to ask the author of the PR in the slack channel or in their PRs or issues themselves why he/she did not write code for something that would require minimal effort on their part.
7881
- Based on basic courtesy, it is good practice to let the person who created a function apply and test that function when needed.
7982
- Last but not the least, communication is important make sure to talk to other contributors, in these cases, in slack channel or in a issue/PR thread.
80-
- As a last resort the Admins would be responsible for deciding how to resolve this conflict.
83+
- As a last resort the Admins would be responsible for deciding how to resolve this conflict.
8184

8285
### Contributing Code
8386

@@ -141,11 +144,13 @@ The process of proposing a change to Talawa API can be summarized as:
141144
13. Review and address comments on your pull request if requested.
142145
143146
## Upgrading Code
144-
Before you start contributing to the repository, you `ALWAYS` need to make sure that your code is up to date with the source repository at `PalisadoesFoundation/talawa-api`.
147+
148+
Before you start contributing to the repository, you `ALWAYS` need to make sure that your code is up to date with the source repository at `PalisadoesFoundation/talawa-api`.
145149
146150
To do we will help you setup an upstream and origin for your repository, which will help you contribute code with great ease:-
147151
148152
#### Setting up Upstream and Origin
153+
149154
After cloning your forked repository, your origin remote is pointing to your fork (`{{GITHUB USERNAME}}/talawa-api`). To stay up to date with the main `PalisadoesFoundation/talawa-api` repository, add it as a remote called upstream. You'll first need to move into the `talawa-api` directory that was created by the clone operation.
150155
151156
```
@@ -167,19 +172,22 @@ We have established a clean setup now. We can make any changes we like and push
167172
![Diagram of the fork-and-clone workflow](./image/install3.png)
168173
169174
#### Creating a Pull Request - Process Overview
170-
For making any changes to original repository, we first sync our cloned repository with original repository. We merge `develop` with `upstream/develop` to do this.
175+
176+
For making any changes to original repository, we first sync our cloned repository with original repository. We merge `develop` with `upstream/develop` to do this.
171177
This make sometimes require a hard reset, and can be done with the following commands:
178+
172179
```
173180
git fetch upstream
174181
git reset upstream/develop --hard
175182
```
176-
Now we make a new branch (with `git checkout -b {{ BRANCH_NAME }}` ), do the changes on the branch, add and commit them (with `git add . && git commit -m {{ COMMIT_MESSAGE }}` ), push the branch to forked repository (with `git push origin {{ BRANCH_NAME }} --force` ), and make a PR from Github interface (from our new branch to the `develop` branch of `PalisadoesFoundation/talawa-api` s).
183+
184+
Now we make a new branch (with `git checkout -b {{ BRANCH_NAME }}` ), do the changes on the branch, add and commit them (with `git add . && git commit -m {{ COMMIT_MESSAGE }}` ), push the branch to forked repository (with `git push origin {{ BRANCH_NAME }} --force` ), and make a PR from Github interface (from our new branch to the `develop` branch of `PalisadoesFoundation/talawa-api` s).
177185
178186
We use a different branch to make changes so that we can work on multiple issues while still having a clean version in develop branch.
179187
180188
## Type checking and code quality
181189
182-
On making a PR, we use GitHub actions to check that your code is properly formatted, doesn't have typescript type errors and is properly linted. Here are the checks:-
190+
On making a PR, we use GitHub actions to check that your code is properly formatted, doesn't have typescript type errors and is properly linted. Here are the checks:-
183191
184192
<br/>
185193
@@ -204,11 +212,11 @@ We make use of `eslint` to enforce a strict linting convention in code.
204212
To check code for linting issues use this command:-
205213
206214
npm run lint:check
207-
215+
208216
To check and fix lint errors in code use this command:-
209217
210218
npm run lint:fix
211-
219+
212220
Eslint might throw lint errors even after running the `lint:fix` command as those lint errors require manual intervention to be fixed. You have to fix those lint errors manually.
213221
214222
<br/>
@@ -237,35 +245,41 @@ We are using the package `Husky` to run git hooks that run according to differen
237245
238246
<br/>
239247
240-
#### pre-commit hook
241-
We run a pre-commit hook which automatically runs code quality checks each time you make a commit and also fixes some of the issues. This way you don't have to run them manually each time.
248+
#### Pre-Commit hook
242249
250+
We run a pre-commit hook which automatically runs code quality checks each time you make a commit and also fixes some of the issues. This way you don't have to run them manually each time.
243251
244252
If you don't want these pre-commit checks running on each commit, you can manually opt out of it using the `--no-verify` flag with your commit message as shown:-
245253
246254
git commit -m "commit message" --no-verify
247255
248256
<br/>
249257
250-
251-
#### post-merge hook
258+
#### Post-Merge hook
252259
253260
We are also running a post-merge(post-pull) hook which will automatically run "npm install" only if there is any change made to pakage.json file so that the developer has all the required dependencies when pulling files from remote.
254261
255-
256262
If you don't want this hook to run, you can manually opt out of this using the `no verify` flag while using the merge command(git pull):
257263
258-
git pull --no-verify
264+
git pull --no-verify
259265
260266
<br/>
261267
262-
268+
### GraphQL Voyager
269+
270+
We use the open source project [GraphQL Voyager](https://github.com/IvanGoncharov/graphql-voyager) to help you interact and explore the complete schema in an interactive manner!
271+
272+
Go to `http://localhost:4000/voyager` after running the development server to explore the same!
273+
274+
![Voyager Demo for User Model](../../image/GraphQL_Voyager.png)
275+
263276
### Running Queries with talawa-api
264-
- Talawa API currently implement `GraphQL Playground` as mediator interface to run and test queries directly from the api. [Learn more](https://www.apollographql.com/docs/apollo-server/v2/testing/graphql-playground/)
265-
- In development, Apollo Server enables GraphQL Playground on the same URL as the GraphQL server itself (e.g. http://localhost:4000/graphql) and automatically serves the GUI to web browsers. When NODE_ENV is set to production, GraphQL Playground (as well as introspection) is disabled as a production best-practice.
266-
![image](https://user-images.githubusercontent.com/65951872/221374309-5a6eee74-c0df-4280-a29a-0b8d2c7260b3.png)
277+
278+
- Talawa API currently implement `GraphQL Playground` as mediator interface to run and test queries directly from the api. [Learn more](https://www.apollographql.com/docs/apollo-server/v2/testing/graphql-playground/)
279+
- In development, Apollo Server enables GraphQL Playground on the same URL as the GraphQL server itself (e.g. http://localhost:4000/graphql) and automatically serves the GUI to web browsers. When NODE_ENV is set to production, GraphQL Playground (as well as introspection) is disabled as a production best-practice.
280+
![image](https://user-images.githubusercontent.com/65951872/221374309-5a6eee74-c0df-4280-a29a-0b8d2c7260b3.png)
267281
- Note: To access the playground in talawa API append the URL with "/graphql"
268-
282+
269283
## Internships
270284
271285
If you are participating in any of the various internship programs we ar members of then please read the [introduction guides on our documentation website](https://docs.talawa.io/docs/).

image/GraphQL_Voyager.png

301 KB
Loading

0 commit comments

Comments
 (0)