You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deprecates the example application to focus development on the core plugin and its documentation.
Updates README to reference new package names, clarify usage, and reflect current author info.
Streamlines project structure by eliminating unused sample files, dependencies, and assets.
Copy file name to clipboardExpand all lines: README.md
+16-29Lines changed: 16 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,7 @@
1
+
# gatsby-source-github-graphql
2
+
3
+
Gatsby Source GitHub GraphQL is a Gatsby source plugin that fetches data from GitHub GraphQL API and makes it available in the Gatsby GraphQL Data Layer. It supports subplugins to fetch specific GitHub resources and create relationships between them.
4
+
1
5
## Features
2
6
3
7
- It does **NOT** support Incremental Builds (not tested at least).
@@ -13,9 +17,7 @@
13
17
This package is not published to npm yet, you need to install using [gitpkg](https://gitpkg.now.sh/).
Because I'm building my blog that will be soon available at [alexrintt.io](https://alexrintt.io) and was searching for a plugin that fill these requirements:
63
+
Because I'm building my blog that will be soon available at [alexcastro.dev](https://alexcastro.dev) and was searching for a plugin that fill these requirements:
62
64
63
65
- Fetch data from GitHub GraphQL API.
64
66
- Supports Gatsby GraphQL Data Layer.
@@ -75,7 +77,7 @@ Because I'm building my blog that will be soon available at [alexrintt.io](https
75
77
- Supports image optimization, bandwidth bla-bla - this is also important but lets talk about this motherf [web.dev/optimize-cls](https://web.dev/optimize-cls/).
76
78
- Markdown compatible (or any other markup), at this moment I'm using the discussions of a repository as markdown files to build a blog, but what if I want to switch in the future, or maybe change the processing rule or package?
77
79
78
-
### What I've tried before:
80
+
### What I've tried before
79
81
80
82
-[mosch/gatsby-source-github](https://github.com/mosch/gatsby-source-github/blob/master/src/gatsby-node.js) this unfortunately only supports fetching the file tree and the releases of a repository.
81
83
-[ldd/gatsby-source-github-api](https://github.com/ldd/gatsby-source-github-api) which also doesn't support relationships. All nodes are the same type, which means there are no connection between data required; there are only flat nodes (of type `GithubData`).
@@ -89,17 +91,17 @@ This monorepo is a Gatsby data source plugin + set of source subplugins which ai
89
91
90
92
Technically saying:
91
93
92
-
-`coreplugin`is the actually Gatsby source plugin that is plugged directly into your `gatsby-config.js` and it's available under _/packages/gatsby-source-github-graphql_.
93
-
-`subplugins` can be any Gatsby subplugin (under your Gatsby project at _/plugins/your-gatsby-plugin-that-will-be-used-as-subplugin_ or one of the already supported plugins at _/packages/gatsby-source-github-graphql-some-cool-usecase_ in this repo.
94
-
- The core plugin request it's subplugins to fetch what data they want to `coreplugin.sourceNodes -> subplugins.sourceNodes`.
95
-
- Then the core plugin connect the edges by creating the nodes by it's types `coreplugin.onCreateNodes`.
96
-
- And finally the core plugin request it's subplugins again to create the schema customization through `subplugin.createSchemaCustomization`.
94
+
-Let `coreplugin`be the actual Gatsby source plugin that is plugged directly into your `gatsby-config.js` and it's available under _/packages/gatsby-source-github-graphql_.
95
+
-Let `subplugin`be any Gatsby subplugin (under your Gatsby project at _/plugins/your-gatsby-plugin-that-will-be-used-as-subplugin_ or one of the already supported plugins at _/packages/gatsby-source-github-graphql-some-cool-usecase_ in this repo).
96
+
- The `coreplugin` request it's subplugins to fetch what data they want to `coreplugin.sourceNodes -> subplugins.sourceNodes`.
97
+
- Then the `coreplugin` connect the edges by creating the nodes by it's types `coreplugin.onCreateNodes`.
98
+
- And finally the `coreplugin` request it's subplugins again to create the schema customization through `subplugin.createSchemaCustomization`.
97
99
98
100
This is an answer and a question because I don't know if it's ok to create plugins in this way, I tried to copy/keep the same essence of [gatsbyjs/gatsby/packages/gatsby-transformer-remark](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-transformer-remark) but I'm not sure if it's sustentable, I did it only for personal use while trying to make it easy for me to extend in case of in the future adding some blog feature or modify an existing one.
99
101
100
102
But as always, do you have an idea or recommendation? just push it into the issues stack. Your use-case is not supported yet? feel free [to create a subplugin](#how-to-create-a-subplugin) and open a pull request.
101
103
102
-
## How to create a subplugin
104
+
## How to create a subplugin
103
105
104
106
Lets learn by example, the following section will create a subplugin which will fetch the \[viewer] or a given user from his \[login] and add it to the Gatsby GraphQL Data Layer.
105
107
@@ -288,18 +290,3 @@ A prinscreen of what it should looks like:
0 commit comments