{"id":13452587,"url":"https://github.com/2fd/graphdoc","last_synced_at":"2025-04-13T02:00:19.086Z","repository":{"id":38272764,"uuid":"65252494","full_name":"2fd/graphdoc","owner":"2fd","description":"Static page generator for documenting GraphQL Schema","archived":false,"fork":false,"pushed_at":"2023-01-31T01:32:39.000Z","size":3656,"stargazers_count":1563,"open_issues_count":99,"forks_count":135,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-06T00:05:18.789Z","etag":null,"topics":["documentation","documentation-generator","documentation-tool","graphql"],"latest_commit_sha":null,"homepage":"https://2fd.github.io/graphdoc","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2fd.png","metadata":{"files":{"readme":"README.handlebars","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-09T01:33:28.000Z","updated_at":"2025-03-14T10:02:39.000Z","dependencies_parsed_at":"2023-02-16T14:15:44.803Z","dependency_job_id":null,"html_url":"https://github.com/2fd/graphdoc","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2fd%2Fgraphdoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2fd%2Fgraphdoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2fd%2Fgraphdoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2fd%2Fgraphdoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2fd","download_url":"https://codeload.github.com/2fd/graphdoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654045,"owners_count":21140235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation","documentation-generator","documentation-tool","graphql"],"created_at":"2024-07-31T07:01:28.330Z","updated_at":"2025-04-13T02:00:19.007Z","avatar_url":"https://github.com/2fd.png","language":"TypeScript","readme":"# {{project.description}}\n\n[![build](https://github.com/2fd/graphdoc/workflows/build/badge.svg?branch=master)](https://github.com/2fd/graphdoc/actions?query=workflow%3Abuild+branch%3Amaster+)\n[![coverage](https://coveralls.io/repos/github/2fd/graphdoc/badge.svg?branch=master)](https://coveralls.io/github/2fd/graphdoc?branch=master)\n![npm](https://img.shields.io/npm/v/@2fd/graphdoc.svg)\n![tag](https://img.shields.io/github/tag/2fd/graphdoc.svg)\n\n- [demos](#demos)\n- [install](#install)\n- [use](#use)\n- [plugin](#plugin)\n- [template](#template)\n- [contributors](#contributors)\n\n## Demos\n\n- Facebook Test [Star Wars](https://2fd.github.io/graphdoc/star-wars)\n- [Github V4 API](https://2fd.github.io/graphdoc/github)\n- [Shopify API](https://2fd.github.io/graphdoc/shopify/)\n- [Pokemon GraphQL](https://2fd.github.io/graphdoc/pokemon)\n\n## Install\n\n```bash\n  npm install -g @2fd/graphdoc\n```\n\n## Use\n\n### Generate documentation from live endpoint\n\n```bash\n  \u003e graphdoc -e http://localhost:8080/graphql -o ./doc/schema\n```\n\n### Generate documentation from IDL file\n\n```bash\n  \u003e graphdoc -s ./schema.graphql -o ./doc/schema\n```\n\n### Generate documentation from for the [\"modularized schema\"](http://dev.apollodata.com/tools/graphql-tools/generate-schema.html#modularizing) of graphql-tools\n\n```bash\n  \u003e graphdoc -s ./schema.js -o ./doc/schema\n```\n\n\u003e [`./schema.graphql`](https://github.com/2fd/graphdoc/blob/master/test/starwars.graphql) must be able to be interpreted\n\u003e with [graphql-js/utilities#buildSchema](http://graphql.org/graphql-js/utilities/#buildschema)\n\n### Generate documentation from json file\n\n```bash\n  \u003e graphdoc -s ./schema.json -o ./doc/schema\n```\n\n\u003e `./schema.json` contains the result of [GraphQL introspection\n\u003e query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)\n\n### Puts the options in your `package.json`\n\n```javascript\n  // package.json\n\n  {\n    \"name\": \"project\",\n    \"graphdoc\": {\n      \"endpoint\": \"http://localhost:8080/graphql\",\n      \"output\": \"./doc/schema\",\n    }\n  }\n```\n\nAnd execute\n\n```bash\n  \u003e graphdoc\n```\n\n### Help\n\n```bash\n\n  \u003e graphdoc -h\n  {{{bash \"node ./bin/graphdoc.js --no-color --help\"}}}\n```\n\n## Plugin\n\nIn graphdoc a plugin is simply an object that controls the content that is displayed\non every page of your document.\n\nThis object should only implement the\n[`PluginInterface`](https://github.com/2fd/graphdoc/blob/master/lib/interface.d.ts#L12-L117).\n\n### Make a Plugin\n\nTo create your own plugin you should only create it as a `plain object`\nor a `constructor` and export it as `default`\n\nIf you export your plugin as a constructor, when going to be initialized,\nwill receive three parameters\n\n- `schema`: The full the result of [GraphQL introspection query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)\n- `projectPackage`: The content of `package.json` of current project (or the content of file defined with `--config`\nflag).\n- `graphdocPackage`: The content of `package.json` of graphdoc.\n\n\u003e For performance reasons all plugins receive the reference to the same object\n\u003e and therefore should not modify them directly as it could affect the behavior\n\u003e of other plugins (unless of course that is your intention)\n\n#### Examples\n\n```typescript\n  // es2015 export constructor\n\n  export default class MyPlugin {\n\n    constructor(schema, projectPackage, graphdocPackage) {}\n\n    getAssets() {\n      /* ... */\n    }\n  }\n```\n\n```typescript\n  // es2015 export plain object\n\n  export default cost myPlugin = {\n    getAssets() {\n      /* ... */\n    },\n  }\n```\n\n```javascript\n  // export constructor\n\n  function MyPlugin(schema, projectPackage, graphdocPackage) {\n    /* ... */\n  }\n\n  MyPlugin.prototype.getAssets = function() {\n    /* ... */\n  };\n\n  exports.default = MyPlugin;\n```\n\n```javascript\n  // export plain object\n\n  exports.default = {\n    getAssets: function() {\n      /* ... */\n    }\n  };\n```\n\n### Use plugin\n\nYou can use the plugins in 2 ways.\n\n#### Use plugins with command line\n\n```bash\n  \u003e graphdoc -p graphdoc/plugins/default \\\n  -p some-dependencies/plugin \\\n  -p ./lib/plugin/my-own-plugin \\\n  -s ./schema.json -o ./doc/schema\n```\n\n#### Use plugins with `package.json`\n\n```javascript\n  // package.json\n\n  {\n    \"name\": \"project\",\n    \"graphdoc\": {\n      \"endpoint\": \"http://localhost:8080/graphql\",\n      \"output\": \"./doc/schema\",\n      \"plugins\": [\n        \"graphdoc/plugins/default\",\n        \"some-dependencie/plugin\",\n        \"./lib/plugin/my-own-plugin\"\n      ]\n    }\n  }\n```\n\n### Build-in plugin\n\n\u003e TODO\n\n## Template\n\n\u003e TODO\n\n## Contributors\n\n{{#each contributors}}- [\u003cimg src=\"{{{avatar_url}}}\" width=\"40\"\u003e {{{login}}}]({{{html_url}}})\n{{/each}}","funding_links":[],"categories":["Tools","TypeScript","Documentation Generators"],"sub_categories":["Julia Libraries","Tools - Docs","Crystal Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2fd%2Fgraphdoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2fd%2Fgraphdoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2fd%2Fgraphdoc/lists"}