Skip to content

Commit 45e591a

Browse files
committed
docs: fix readme
1 parent 16823b9 commit 45e591a

File tree

2 files changed

+138
-132
lines changed

2 files changed

+138
-132
lines changed

README.handlebars

Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,27 @@
2222
## Install
2323

2424
```bash
25-
npm install -g @2fd/graphdoc
25+
npm install -g @2fd/graphdoc
2626
```
2727

2828
## Use
2929

3030
### Generate documentation from live endpoint
3131

3232
```bash
33-
> graphdoc -e http://localhost:8080/graphql -o ./doc/schema
33+
> graphdoc -e http://localhost:8080/graphql -o ./doc/schema
3434
```
3535

3636
### Generate documentation from IDL file
3737

3838
```bash
39-
> graphdoc -s ./schema.graphql -o ./doc/schema
39+
> graphdoc -s ./schema.graphql -o ./doc/schema
4040
```
4141

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

4544
```bash
46-
> graphdoc -s ./schema.js -o ./doc/schema
45+
> graphdoc -s ./schema.js -o ./doc/schema
4746
```
4847

4948
> [`./schema.graphql`](https://github.com/2fd/graphdoc/blob/master/test/starwars.graphql) must be able to be interpreted
@@ -52,7 +51,7 @@ schema"](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modu
5251
### Generate documentation from json file
5352

5453
```bash
55-
> graphdoc -s ./schema.json -o ./doc/schema
54+
> graphdoc -s ./schema.json -o ./doc/schema
5655
```
5756

5857
> `./schema.json` contains the result of [GraphQL introspection
@@ -61,29 +60,29 @@ schema"](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modu
6160
### Puts the options in your `package.json`
6261

6362
```javascript
64-
// package.json
65-
66-
{
67-
"name": "project",
68-
"graphdoc": {
69-
"endpoint": "http://localhost:8080/graphql",
70-
"output": "./doc/schema",
71-
}
72-
}
63+
// package.json
64+
65+
{
66+
"name": "project",
67+
"graphdoc": {
68+
"endpoint": "http://localhost:8080/graphql",
69+
"output": "./doc/schema",
70+
}
71+
}
7372
```
7473

7574
And execute
7675

7776
```bash
78-
> graphdoc
77+
> graphdoc
7978
```
8079

8180
### Help
8281

8382
```bash
8483

85-
> graphdoc -h
86-
{{{bash "node ./bin/graphdoc.js --no-color --help"}}}
84+
> graphdoc -h
85+
{{{bash "node ./bin/graphdoc.js --no-color --help"}}}
8786
```
8887

8988
## Plugin
@@ -102,8 +101,7 @@ or a `constructor` and export it as `default`
102101
If you export your plugin as a constructor, when going to be initialized,
103102
will receive three parameters
104103

105-
- `schema`: The full the result of [GraphQL introspection
106-
query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
104+
- `schema`: The full the result of [GraphQL introspection query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)
107105
- `projectPackage`: The content of `package.json` of current project (or the content of file defined with `--config`
108106
flag).
109107
- `graphdocPackage`: The content of `package.json` of graphdoc.
@@ -115,45 +113,50 @@ flag).
115113
#### Examples
116114

117115
```typescript
118-
// es2015 export constructor
119-
export default class MyPlugin {
120-
constructor(schema, projectPackage, graphdocPackage) {}
121-
getAssets() {
122-
/* ... */
123-
}
124-
}
116+
// es2015 export constructor
117+
118+
export default class MyPlugin {
119+
120+
constructor(schema, projectPackage, graphdocPackage) {}
121+
122+
getAssets() {
123+
/* ... */
124+
}
125+
}
125126
```
126127

127128
```typescript
128-
// es2015 export plain object
129-
export default cost myPlugin = {
130-
getAssets() {
131-
/* ... */
132-
},
133-
}
129+
// es2015 export plain object
130+
131+
export default cost myPlugin = {
132+
getAssets() {
133+
/* ... */
134+
},
135+
}
134136
```
135137

136138
```javascript
137-
// export constructor
138-
function MyPlugin(schema, projectPackage, graphdocPackage) {
139-
/* ... */
140-
}
139+
// export constructor
140+
141+
function MyPlugin(schema, projectPackage, graphdocPackage) {
142+
/* ... */
143+
}
141144

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

146-
exports.default = MyPlugin;
149+
exports.default = MyPlugin;
147150
```
148151

149152
```javascript
150-
// export plain object
153+
// export plain object
151154

152-
exports.default = {
153-
getAssets: function() {
154-
/* ... */
155-
}
156-
};
155+
exports.default = {
156+
getAssets: function() {
157+
/* ... */
158+
}
159+
};
157160
```
158161

159162
### Use plugin
@@ -163,29 +166,29 @@ You can use the plugins in 2 ways.
163166
#### Use plugins with command line
164167

165168
```bash
166-
> graphdoc -p graphdoc/plugins/default \
167-
-p some-dependencies/plugin \
168-
-p ./lib/plugin/my-own-plugin \
169-
-s ./schema.json -o ./doc/schema
169+
> graphdoc -p graphdoc/plugins/default \
170+
-p some-dependencies/plugin \
171+
-p ./lib/plugin/my-own-plugin \
172+
-s ./schema.json -o ./doc/schema
170173
```
171174

172175
#### Use plugins with `package.json`
173176

174177
```javascript
175-
// package.json
176-
177-
{
178-
"name": "project",
179-
"graphdoc": {
180-
"endpoint": "http://localhost:8080/graphql",
181-
"output": "./doc/schema",
182-
"plugins": [
183-
"graphdoc/plugins/default",
184-
"some-dependencie/plugin",
185-
"./lib/plugin/my-own-plugin"
186-
]
187-
}
188-
}
178+
// package.json
179+
180+
{
181+
"name": "project",
182+
"graphdoc": {
183+
"endpoint": "http://localhost:8080/graphql",
184+
"output": "./doc/schema",
185+
"plugins": [
186+
"graphdoc/plugins/default",
187+
"some-dependencie/plugin",
188+
"./lib/plugin/my-own-plugin"
189+
]
190+
}
191+
}
189192
```
190193

191194
### Build-in plugin

0 commit comments

Comments
 (0)