Skip to content

Commit

Permalink
doc: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
2fd committed Dec 20, 2020
1 parent c25f8c1 commit ab18124
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release workflow
name: build

on:
push:
Expand Down
73 changes: 37 additions & 36 deletions README.handlebars
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# {{project.description}}

[![Build Status](https://travis-ci.org/2fd/graphdoc.svg?branch=master)](https://travis-ci.org/2fd/graphdoc)
[![build](https://github.com/2fd/graphdoc/workflows/build/badge.svg?branch=master)](https://github.com/2fd/graphdoc/actions)
![npm (scoped)](https://img.shields.io/npm/v/@2fd/graphdoc.svg?style=flat-square)
![GitHub tag](https://img.shields.io/github/tag/2fd/graphdoc.svg?style=flat-square)
[![Coverage
Expand Down Expand Up @@ -40,7 +40,8 @@ npm install -g @2fd/graphdoc
> graphdoc -s ./schema.graphql -o ./doc/schema
```

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

```bash
> graphdoc -s ./schema.js -o ./doc/schema
Expand All @@ -64,11 +65,11 @@ npm install -g @2fd/graphdoc
// package.json

{
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
}
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
}
}
```

Expand All @@ -83,7 +84,7 @@ And execute
```bash

> graphdoc -h
{{{bash "node ./bin/graphdoc.js --no-color --help"}}}
{{{bash "node ./bin/graphdoc.js --no-color --help"}}}
```

## Plugin
Expand All @@ -103,9 +104,9 @@ If you export your plugin as a constructor, when going to be initialized,
will receive three parameters

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

> For performance reasons all plugins receive the reference to the same object
Expand All @@ -117,30 +118,30 @@ will receive three parameters
```typescript
// es2015 export constructor
export default class MyPlugin {
constructor(schema, projectPackage, graphdocPackage) {}
getAssets() {
/* ... */
}
constructor(schema, projectPackage, graphdocPackage) {}
getAssets() {
/* ... */
}
}
```

```typescript
// es2015 export plain object
export default cost myPlugin = {
getAssets() {
/* ... */
},
getAssets() {
/* ... */
},
}
```

```javascript
// export constructor
function MyPlugin(schema, projectPackage, graphdocPackage) {
/* ... */
/* ... */
}

MyPlugin.prototype.getAssets = function() {
/* ... */
/* ... */
};

exports.default = MyPlugin;
Expand All @@ -150,9 +151,9 @@ exports.default = MyPlugin;
// export plain object

exports.default = {
getAssets: function() {
/* ... */
}
getAssets: function() {
/* ... */
}
};
```

Expand All @@ -164,9 +165,9 @@ You can use the plugins in 2 ways.

```bash
> graphdoc -p graphdoc/plugins/default \
-p some-dependencies/plugin \
-p ./lib/plugin/my-own-plugin \
-s ./schema.json -o ./doc/schema
-p some-dependencies/plugin \
-p ./lib/plugin/my-own-plugin \
-s ./schema.json -o ./doc/schema
```

#### Use plugins with `package.json`
Expand All @@ -175,16 +176,16 @@ You can use the plugins in 2 ways.
// package.json

{
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
"plugins": [
"graphdoc/plugins/default",
"some-dependencie/plugin",
"./lib/plugin/my-own-plugin"
]
}
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
"plugins": [
"graphdoc/plugins/default",
"some-dependencie/plugin",
"./lib/plugin/my-own-plugin"
]
}
}
```

Expand All @@ -199,4 +200,4 @@ You can use the plugins in 2 ways.
## Contributors

{{#each contributors}}- [<img src="{{{avatar_url}}}" width="40"> {{{login}}}]({{{html_url}}})
{{/each}}
{{/each}}
53 changes: 28 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Static page generator for documenting GraphQL Schema

[![Build Status](https://travis-ci.org/2fd/graphdoc.svg?branch=master)](https://travis-ci.org/2fd/graphdoc)
[![build](https://github.com/2fd/graphdoc/workflows/release/badge.svg?branch=master)](https://github.com/2fd/graphdoc/actions)
![npm (scoped)](https://img.shields.io/npm/v/@2fd/graphdoc.svg?style=flat-square)
![GitHub tag](https://img.shields.io/github/tag/2fd/graphdoc.svg?style=flat-square)
[![Coverage
Expand Down Expand Up @@ -40,7 +40,9 @@ npm install -g @2fd/graphdoc
> graphdoc -s ./schema.graphql -o ./doc/schema
```

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

schema"](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modularizing) of graphql-tools

```bash
> graphdoc -s ./schema.js -o ./doc/schema
Expand All @@ -64,11 +66,11 @@ npm install -g @2fd/graphdoc
// package.json

{
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
}
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
}
}
```

Expand All @@ -86,9 +88,9 @@ And execute

Static page generator for documenting GraphQL Schema v2.4.0

Usage: node bin/graphdoc.js [OPTIONS]
Usage: node bin/graphdoc.js [OPTIONS]



[OPTIONS]:
-c, --config Configuration file [./package.json].
-e, --endpoint Graphql http endpoint ["https://domain.com/graphql"].
Expand Down Expand Up @@ -149,9 +151,9 @@ export default class MyPlugin {
```typescript
// es2015 export plain object
export default cost myPlugin = {
getAssets() {
/* ... */
},
getAssets() {
/* ... */
},
}
```
Expand Down Expand Up @@ -186,9 +188,9 @@ You can use the plugins in 2 ways.
```bash
> graphdoc -p graphdoc/plugins/default \
-p some-dependencies/plugin \
-p ./lib/plugin/my-own-plugin \
-s ./schema.json -o ./doc/schema
-p some-dependencies/plugin \
-p ./lib/plugin/my-own-plugin \
-s ./schema.json -o ./doc/schema
```
#### Use plugins with `package.json`
Expand All @@ -197,16 +199,16 @@ You can use the plugins in 2 ways.
// package.json

{
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
"plugins": [
"graphdoc/plugins/default",
"some-dependencie/plugin",
"./lib/plugin/my-own-plugin"
]
}
"name": "project",
"graphdoc": {
"endpoint": "http://localhost:8080/graphql",
"output": "./doc/schema",
"plugins": [
"graphdoc/plugins/default",
"some-dependencie/plugin",
"./lib/plugin/my-own-plugin"
]
}
}
```
Expand All @@ -220,6 +222,7 @@ You can use the plugins in 2 ways.
## Contributors
- [<img src="https://avatars3.githubusercontent.com/in/2141?v=4" width="40"> dependabot-preview[bot]](https://github.com/apps/dependabot-preview)
- [<img src="https://avatars2.githubusercontent.com/u/1301838?v=4" width="40"> bitliner](https://github.com/bitliner)
- [<img src="https://avatars0.githubusercontent.com/u/605742?v=4" width="40"> kbariotis](https://github.com/kbariotis)
- [<img src="https://avatars3.githubusercontent.com/u/26602940?v=4" width="40"> 0xflotus](https://github.com/0xflotus)
Expand Down

0 comments on commit ab18124

Please sign in to comment.