Skip to content

Commit 407f1d7

Browse files
authored
Merge pull request #963 from graphql/docs
Docs for the code page & CI
2 parents d5d1b33 + 475b842 commit 407f1d7

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

.github/workflows/CI.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
on: pull_request
3+
4+
jobs:
5+
tests:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: actions/setup-node@v1
11+
12+
- run: yarn install
13+
14+
# Verify it compiles
15+
- run: yarn build
16+
17+
# Doesn't pass ATM
18+
# - run: yarn tsc --noEmit

notes/ContributingToCodePage.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
## Contributing to the Code Page
2+
3+
Hi, thanks for reading the docs!
4+
5+
Secondly, we want to provide a really strong overview of all the libraries in the GraphQL eco-system. To make this
6+
easy for contributors the code page is automatically generated from a series of markdown files in this repo.
7+
8+
```sh
9+
$ tree src/content/code
10+
src/content/code
11+
├── language-support
12+
│ ├── c-c
13+
│ │ └── tools
14+
│ │ └── libgraphqlparser.md
15+
│ ├── clojure
16+
│ │ ├── client
17+
│ │ │ └── regraph.md
18+
│ │ └── server
19+
│ │ ├── alumbra.md
20+
│ │ ├── graphql-clj.md
21+
│ │ └── lacinia.md
22+
│ ├── c-net
23+
│ │ ├── client
24+
│ │ │ ├── graphql-client.md
25+
│ │ │ ├── graphql-net-client.md
26+
│ │ │ └── sahb-graphqlclient.md
27+
// etc
28+
```
29+
30+
We'd love any new project to include a few paragraphs describing its goals and usage, the goal here is to make it easy for people to decide between options.
31+
32+
Here's an optimal example example of what we're looking for:
33+
34+
- It uses yml frontmatter to provide additional information like repo, npm
35+
- It explains itself in the 'description' then fills fleshes out that description with some code samples
36+
37+
````md
38+
---
39+
name: Express GraphQL
40+
description: The reference implementation of a GraphQL API server over an Express webserver. You can use this to run GraphQL in conjunction with a regular Express webserver, or as a standalone GraphQL server.
41+
url: /graphql-js/running-an-express-graphql-server/
42+
github: graphql/express-graphql
43+
npm: "express-graphql"
44+
---
45+
46+
To run an `express-graphql` hello world server:
47+
48+
```bash
49+
npm install express express-graphql graphql
50+
```
51+
52+
Then run `node server.js` with this code in `server.js`:
53+
54+
```js
55+
var express = require('express');
56+
var { graphqlHTTP } = require('express-graphql');
57+
var { buildSchema } = require('graphql');
58+
59+
var schema = buildSchema(`
60+
type Query {
61+
hello: String
62+
}
63+
`);
64+
65+
var root = { hello: () => 'Hello world!' };
66+
67+
var app = express();
68+
app.use('/graphql', graphqlHTTP({
69+
schema: schema,
70+
rootValue: root,
71+
graphiql: true,
72+
}));
73+
app.listen(4000, () => console.log('Now browse to localhost:4000/graphql'));
74+
```
75+
76+
````
77+
78+
Any library/tool/service has a maximum height in the site, and then it can be expanded by clicking, so if you need quite a lot of space to explain your project then that's OK.

src/pages/code.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ export default ({ pageContext }: any) => {
251251
{buildLibraryList(pageContext.otherLibraries.Services, pageContext)}
252252
</div>
253253
</div>
254+
<p>Want to improve this page? See the <a href="https://github.com/graphql/graphql.github.io/blob/source/notes/ContributingToCodePage.md">docs here</a>.</p>
254255
</section>
255256
</Layout>
256257
)

0 commit comments

Comments
 (0)