Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] Refactor and document APIs #1053

Merged
merged 23 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b46a59b
Add basic version of new documentation.js transformer
KyleAMathews May 28, 2017
ab7ba98
Change api 'addFieldToNode' to 'createNodeField'
KyleAMathews May 29, 2017
45f7a31
Fix up node creation and add some simple tests
KyleAMathews May 30, 2017
1067771
Get basic docs page for action creators up
KyleAMathews May 30, 2017
0e39282
change deletePageByPath to just deletePage also sort action creators …
KyleAMathews May 30, 2017
d27833d
Change 'upsertPage' to 'createPage' and document it
KyleAMathews May 30, 2017
8a7575d
Only hide parent object description if its a desctructured object + i…
KyleAMathews May 30, 2017
61b79ff
Update action type
KyleAMathews May 30, 2017
776f77d
Support third level of parameters
KyleAMathews May 30, 2017
8863d25
Document createNode
KyleAMathews May 30, 2017
3697716
change 'addNodeToParent' to 'createParentChildLink' and document
KyleAMathews May 30, 2017
9e1c25a
Change 'addPageDependency' to 'createPageDependency' and document
KyleAMathews May 30, 2017
a8108ab
rename internal APIs
KyleAMathews May 30, 2017
5b0528b
Add links from function names at top to reference
KyleAMathews May 30, 2017
cba9b46
Ignore yarn.lock
KyleAMathews May 30, 2017
3ad7e09
Don't change the changelog...
KyleAMathews May 30, 2017
3c77aa3
Document and slightly modify node APIs
KyleAMathews May 31, 2017
6acd904
Factor out a FunctionsList component for rendering function docs
KyleAMathews May 31, 2017
6d536b3
Add browser/ssr docs and make a few tweaks to APIs
KyleAMathews May 31, 2017
62461fe
Add API specification document
KyleAMathews May 31, 2017
b5d634c
Actually add docs for node/browser/ssr
KyleAMathews May 31, 2017
e6600ab
Tweaks
KyleAMathews May 31, 2017
385bc78
Add README for gatsby-transformer-documentationjs
KyleAMathews May 31, 2017
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add README for gatsby-transformer-documentationjs
  • Loading branch information
KyleAMathews committed May 31, 2017
commit 385bc78dc7bff974ed0e3fab9678bfac6bfa84a3
1 change: 1 addition & 0 deletions docs/docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mean converting this file into a JS component).

## Official plugins

* [gatsby-transformer-documentationjs](/docs/packages/gatsby-transformer-documentationjs/)
* [gatsby-transformer-json](/docs/packages/gatsby-transformer-json/)
* [gatsby-transformer-remark](/docs/packages/gatsby-transformer-remark/)
* [gatsby-transformer-sharp](/docs/packages/gatsby-transformer-sharp/)
Expand Down
75 changes: 75 additions & 0 deletions packages/gatsby-transformer-documentationjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# gatsby-transformer-documentationjs

Uses [Documentation.js](https://documentation.js.org) to extract
code metadata (JSDocs is supported currently though Flow is also supported
by Documentation.js and can be added to this plugin as well).

It's used on gatsbyjs.org and can be seen in use on several pages
there e.g. https://www.gatsbyjs.org/docs/node-apis/

## Install

`npm install --save gatsby-transformer-documentationjs`

## How to use

Add the plugin to your `gatsby-config.js`.

```javascript
plugins: [
`gatsby-transformer-documentationjs`,
]
```

Ensure that there's an instance of `gatsby-source-filesystem` that's
pointed at your source code e.g.

```javascript
plugins: [
`gatsby-transformer-documentationjs`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `source`,
path: `${__dirname}/../src/`,
},
},
]
```

Then you can write GraphQL queries pulling out JSDoc comments like:

```graphql
{
allDocumentationJs {
edges {
node {
name
description {
childMarkdownRemark {
html
}
}
returns {
title
}
examples {
raw
highlighted
}
params {
name
type {
name
}
description {
childMarkdownRemark {
html
}
}
}
}
}
}
}
```