Skip to content

Commit 2ddb37c

Browse files
committed
doc: fix README generator
1 parent f40ff8b commit 2ddb37c

File tree

2 files changed

+82
-87
lines changed

2 files changed

+82
-87
lines changed

README.handlebars

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@
33
[![Build Status](https://travis-ci.org/2fd/graphdoc.svg?branch=master)](https://travis-ci.org/2fd/graphdoc)
44
![npm (scoped)](https://img.shields.io/npm/v/@2fd/graphdoc.svg?style=flat-square)
55
![GitHub tag](https://img.shields.io/github/tag/2fd/graphdoc.svg?style=flat-square)
6+
[![Coverage
7+
Status](https://coveralls.io/repos/github/2fd/graphdoc/badge.svg?branch=master)](https://coveralls.io/github/2fd/graphdoc?branch=master)
68

7-
* [demos](#demos)
8-
* [install](#install)
9-
* [use](#use)
10-
* [plugin](#plugin)
11-
* [template](#template)
12-
* [contributors](#contributors)
9+
- [demos](#demos)
10+
- [install](#install)
11+
- [use](#use)
12+
- [plugin](#plugin)
13+
- [template](#template)
14+
- [contributors](#contributors)
1315

1416
## Demos
1517

16-
* Facebook Test [Star Wars](https://2fd.github.io/graphdoc/star-wars)
17-
* [Github V4 API](https://2fd.github.io/graphdoc/github)
18-
* [Shopify API](https://2fd.github.io/graphdoc/shopify/)
19-
* [Pokemon GraphQL](https://2fd.github.io/graphdoc/pokemon)
18+
- Facebook Test [Star Wars](https://2fd.github.io/graphdoc/star-wars)
19+
- [Github V4 API](https://2fd.github.io/graphdoc/github)
20+
- [Shopify API](https://2fd.github.io/graphdoc/shopify/)
21+
- [Pokemon GraphQL](https://2fd.github.io/graphdoc/pokemon)
2022

2123
## Install
2224

@@ -39,15 +41,15 @@ npm install -g @2fd/graphdoc
3941
```
4042

4143
### Generate documentation from for the ["modularized
44+
4245
schema"](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modularizing) of graphql-tools
4346

4447
```bash
4548
> graphdoc -s ./schema.js -o ./doc/schema
4649
```
4750

4851
> [`./schema.graphql`](https://github.com/2fd/graphdoc/blob/master/test/starwars.graphql) must be able to be interpreted
49-
with [graphql-js/utilities#buildSchema](http://graphql.org/graphql-js/utilities/#buildschema)
50-
52+
> with [graphql-js/utilities#buildSchema](http://graphql.org/graphql-js/utilities/#buildschema)
5153

5254
### Generate documentation from json file
5355

@@ -56,20 +58,19 @@ with [graphql-js/utilities#buildSchema](http://graphql.org/graphql-js/utilities/
5658
```
5759

5860
> `./schema.json` contains the result of [GraphQL introspection
59-
query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
61+
> query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
6062

6163
### Puts the options in your `package.json`
6264

6365
```javascript
6466
// package.json
6567

6668
{
67-
"name": "project",
68-
// [...]
69-
"graphdoc": {
70-
"endpoint": "http://localhost:8080/graphql",
71-
"output": "./doc/schema",
72-
}
69+
"name": "project",
70+
"graphdoc": {
71+
"endpoint": "http://localhost:8080/graphql",
72+
"output": "./doc/schema",
73+
}
7374
}
7475
```
7576

@@ -103,11 +104,11 @@ or a `constructor` and export it as `default`
103104
If you export your plugin as a constructor, when going to be initialized,
104105
will receive three parameters
105106

106-
* `schema`: The full the result of [GraphQL introspection
107-
query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
108-
* `projectPackage`: The content of `package.json` of current project (or the content of file defined with `--config`
109-
flag).
110-
* `graphdocPackage`: The content of `package.json` of graphdoc.
107+
- `schema`: The full the result of [GraphQL introspection
108+
query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
109+
- `projectPackage`: The content of `package.json` of current project (or the content of file defined with `--config`
110+
flag).
111+
- `graphdocPackage`: The content of `package.json` of graphdoc.
111112

112113
> For performance reasons all plugins receive the reference to the same object
113114
> and therefore should not modify them directly as it could affect the behavior
@@ -116,58 +117,58 @@ flag).
116117
#### Examples
117118

118119
```typescript
119-
120120
// es2015 export constructor
121121
export default class MyPlugin {
122-
constructor(schema, projectPackage, graphdocPackage){}
123-
getAssets() { /* ... */ }
124-
/* ... */
122+
constructor(schema, projectPackage, graphdocPackage) {}
123+
getAssets() {
124+
/* ... */
125+
}
125126
}
126-
127127
```
128128

129129
```typescript
130130
// es2015 export plain object
131131
export default cost myPlugin = {
132-
getAssets() { /* ... */ },
133-
/* ... */
132+
getAssets() {
133+
/* ... */
134+
},
134135
}
135136
```
136137

137138
```javascript
138-
139139
// export constructor
140-
function MyPlugin(schema, projectPackage, graphdocPackage) { /* ... */ }
140+
function MyPlugin(schema, projectPackage, graphdocPackage) {
141+
/* ... */
142+
}
141143

142-
MyPlugin.prototype.getAssets = function() { /* ... */ };
143-
/* ... */
144+
MyPlugin.prototype.getAssets = function() {
145+
/* ... */
146+
};
144147

145148
exports.default = MyPlugin;
146149
```
147150

148151
```javascript
149-
150152
// export plain object
151153

152154
exports.default = {
153-
getAssets: function() { /* ... */ },
154-
/* ... */
155-
}
156-
155+
getAssets: function() {
156+
/* ... */
157+
}
158+
};
157159
```
158160

159161
### Use plugin
160162

161163
You can use the plugins in 2 ways.
162164

163-
164165
#### Use plugins with command line
165166

166167
```bash
167168
> graphdoc -p graphdoc/plugins/default \
168-
-p some-dependencies/plugin \
169-
-p ./lib/plugin/my-own-plugin \
170-
-s ./schema.json -o ./doc/schema
169+
-p some-dependencies/plugin \
170+
-p ./lib/plugin/my-own-plugin \
171+
-s ./schema.json -o ./doc/schema
171172
```
172173

173174
#### Use plugins with `package.json`
@@ -176,17 +177,16 @@ You can use the plugins in 2 ways.
176177
// package.json
177178

178179
{
179-
"name": "project",
180-
// [...]
181-
"graphdoc": {
182-
"endpoint": "http://localhost:8080/graphql",
183-
"output": "./doc/schema",
184-
"plugins": [
185-
"graphdoc/plugins/default",
186-
"some-dependencie/plugin",
187-
"./lib/plugin/my-own-plugin"
188-
]
189-
}
180+
"name": "project",
181+
"graphdoc": {
182+
"endpoint": "http://localhost:8080/graphql",
183+
"output": "./doc/schema",
184+
"plugins": [
185+
"graphdoc/plugins/default",
186+
"some-dependencie/plugin",
187+
"./lib/plugin/my-own-plugin"
188+
]
189+
}
190190
}
191191
```
192192

@@ -198,9 +198,7 @@ You can use the plugins in 2 ways.
198198

199199
> TODO
200200

201-
202201
## Contributors
203202

204-
{{#each contributors}}
205-
* [<img src="{{{avatar_url}}}" width="40"> {{{login}}}]({{{html_url}}})
206-
{{/each}}
203+
{{#each contributors}}- [<img src="{{{avatar_url}}}" width="40"> {{{login}}}]({{{html_url}}})
204+
{{/each}}

README.md

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[![Build Status](https://travis-ci.org/2fd/graphdoc.svg?branch=master)](https://travis-ci.org/2fd/graphdoc)
44
![npm (scoped)](https://img.shields.io/npm/v/@2fd/graphdoc.svg?style=flat-square)
55
![GitHub tag](https://img.shields.io/github/tag/2fd/graphdoc.svg?style=flat-square)
6-
[![Coverage Status](https://coveralls.io/repos/github/2fd/graphdoc/badge.svg?branch=master)](https://coveralls.io/github/2fd/graphdoc?branch=master)
6+
[![Coverage
7+
Status](https://coveralls.io/repos/github/2fd/graphdoc/badge.svg?branch=master)](https://coveralls.io/github/2fd/graphdoc?branch=master)
78

89
- [demos](#demos)
910
- [install](#install)
@@ -65,12 +66,11 @@ schema"](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modu
6566
// package.json
6667

6768
{
68-
"name": "project",
69-
// [...]
70-
"graphdoc": {
71-
"endpoint": "http://localhost:8080/graphql",
72-
"output": "./doc/schema",
73-
}
69+
"name": "project",
70+
"graphdoc": {
71+
"endpoint": "http://localhost:8080/graphql",
72+
"output": "./doc/schema",
73+
}
7474
}
7575
```
7676

@@ -88,9 +88,9 @@ And execute
8888

8989
Static page generator for documenting GraphQL Schema v2.4.0
9090

91-
Usage: node bin/graphdoc.js [OPTIONS]
92-
91+
Usage: node bin/graphdoc.js [OPTIONS]
9392

93+
9494
[OPTIONS]:
9595
-c, --config Configuration file [./package.json].
9696
-e, --endpoint Graphql http endpoint ["https://domain.com/graphql"].
@@ -145,15 +145,15 @@ export default class MyPlugin {
145145
getAssets() {
146146
/* ... */
147147
}
148-
/* ... */
149148
}
150149
```
151150
152151
```typescript
153152
// es2015 export plain object
154153
export default cost myPlugin = {
155-
getAssets() { /* ... */ },
156-
/* ... */
154+
getAssets() {
155+
/* ... */
156+
},
157157
}
158158
```
159159
@@ -166,7 +166,6 @@ function MyPlugin(schema, projectPackage, graphdocPackage) {
166166
MyPlugin.prototype.getAssets = function() {
167167
/* ... */
168168
};
169-
/* ... */
170169

171170
exports.default = MyPlugin;
172171
```
@@ -178,7 +177,6 @@ exports.default = {
178177
getAssets: function() {
179178
/* ... */
180179
}
181-
/* ... */
182180
};
183181
```
184182
@@ -190,9 +188,9 @@ You can use the plugins in 2 ways.
190188
191189
```bash
192190
> graphdoc -p graphdoc/plugins/default \
193-
-p some-dependencies/plugin \
194-
-p ./lib/plugin/my-own-plugin \
195-
-s ./schema.json -o ./doc/schema
191+
-p some-dependencies/plugin \
192+
-p ./lib/plugin/my-own-plugin \
193+
-s ./schema.json -o ./doc/schema
196194
```
197195
198196
#### Use plugins with `package.json`
@@ -201,17 +199,16 @@ You can use the plugins in 2 ways.
201199
// package.json
202200

203201
{
204-
"name": "project",
205-
// [...]
206-
"graphdoc": {
207-
"endpoint": "http://localhost:8080/graphql",
208-
"output": "./doc/schema",
209-
"plugins": [
210-
"graphdoc/plugins/default",
211-
"some-dependencie/plugin",
212-
"./lib/plugin/my-own-plugin"
213-
]
214-
}
202+
"name": "project",
203+
"graphdoc": {
204+
"endpoint": "http://localhost:8080/graphql",
205+
"output": "./doc/schema",
206+
"plugins": [
207+
"graphdoc/plugins/default",
208+
"some-dependencie/plugin",
209+
"./lib/plugin/my-own-plugin"
210+
]
211+
}
215212
}
216213
```
217214

0 commit comments

Comments
 (0)