Skip to content

Commit 0e05b49

Browse files
committed
Removes example Gatsby app and updates main docs
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.
1 parent 82a0b6d commit 0e05b49

File tree

35 files changed

+45
-48
lines changed

35 files changed

+45
-48
lines changed

README.md

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff 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+
15
## Features
26

37
- It does **NOT** support Incremental Builds (not tested at least).
@@ -13,9 +17,7 @@
1317
This package is not published to npm yet, you need to install using [gitpkg](https://gitpkg.now.sh/).
1418

1519
```shell
16-
npm install https://gitpkg.now.sh/alexrintt/gatsby-source-github-graphql/packages/gatsby-source-github-graphql?main
17-
# or
18-
yarn add https://gitpkg.now.sh/alexrintt/gatsby-source-github-graphql/packages/gatsby-source-github-graphql?main
20+
npm install @libsrcdev/gatsby-source-github-graphql
1921
```
2022

2123
## Usage
@@ -26,22 +28,22 @@ module.exports = {
2628
// ...
2729
plugins: [
2830
{
29-
resolve: `gatsby-source-github-graphql`,
31+
resolve: `@libsrcdev/gatsby-source-github-graphql`,
3032
// Required, GitHub only allow authenticated requests.
3133
// Your token is not shared across subplugins even if you specify a custom token to it.
3234
token: process.env.GITHUB_TOKEN,
3335
options: {
3436
plugins: [
3537
{
36-
resolve: `gatsby-source-github-graphql-discussions`,
38+
resolve: `@libsrcdev/gatsby-source-github-graphql-discussions`,
3739
options: {
3840
owner: `<your-target-username>`,
3941
repo: `<your-target-user-repo>`
4042
},
4143
},
4244
{
4345
// You can duplicate the plugins to fetch data from multiple times from different sources.
44-
resolve: `gatsby-source-github-graphql-discussions`,
46+
resolve: `@libsrcdev/gatsby-source-github-graphql-discussions`,
4547
options: {
4648
owner: `<your-another-target-username>`,
4749
repo: `<another-target-user-repo>`,
@@ -58,7 +60,7 @@ module.exports = {
5860

5961
## Why does it exists
6062

61-
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:
6264

6365
- Fetch data from GitHub GraphQL API.
6466
- Supports Gatsby GraphQL Data Layer.
@@ -75,7 +77,7 @@ Because I'm building my blog that will be soon available at [alexrintt.io](https
7577
- 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/).
7678
- 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?
7779

78-
### What I've tried before:
80+
### What I've tried before
7981

8082
- [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.
8183
- [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
8991

9092
Technically saying:
9193

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`.
9799

98100
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.
99101

100102
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.
101103

102-
## How to create a subplugin
104+
## How to create a subplugin
103105

104106
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.
105107

@@ -288,18 +290,3 @@ A prinscreen of what it should looks like:
288290
<img src="https://user-images.githubusercontent.com/51419598/196519795-2041eeb3-5d1b-438a-9012-720a6f71d24c.png">
289291

290292
11. Now keep hacking and use it to build your website/blog.
291-
292-
<samp>
293-
294-
<h2 align="center">
295-
Open Source
296-
</h2>
297-
<p align="center">
298-
<sub>Copyright © 2022-present, Alex Rintt.</sub>
299-
</p>
300-
<p align="center">Gatsby Source GitHub GraphQL <a href="/LICENSE">is MIT licensed 💖</a></p>
301-
<p align="center">
302-
<img src="https://user-images.githubusercontent.com/51419598/194058464-f67c7fb5-9066-49b5-aa94-cf34830708ad.png" width="35" />
303-
</p>
304-
305-
</samp>

packages/example-using-gatsby-source-github-graphql/.gitignore renamed to examples/example-using-gatsby-source-github-graphql/.gitignore

File renamed without changes.

packages/example-using-gatsby-source-github-graphql/.prettierignore renamed to examples/example-using-gatsby-source-github-graphql/.prettierignore

File renamed without changes.

packages/example-using-gatsby-source-github-graphql/.prettierrc renamed to examples/example-using-gatsby-source-github-graphql/.prettierrc

File renamed without changes.

packages/example-using-gatsby-source-github-graphql/LICENSE renamed to examples/example-using-gatsby-source-github-graphql/LICENSE

File renamed without changes.

packages/example-using-gatsby-source-github-graphql/README.md renamed to examples/example-using-gatsby-source-github-graphql/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
> **Warning** this is a just a example app that has no styles or customized UI, only the configured data-source plugin of this monorepo.
22
3-
See details at the [monorepo root](https://github.com/alexrintt/gatsby-source-github-graphql).
3+
See details at the [monorepo root](https://github.com/libsrcdev/gatsby-source-github-graphql).

packages/example-using-gatsby-source-github-graphql/gatsby-browser.js renamed to examples/example-using-gatsby-source-github-graphql/gatsby-browser.js

File renamed without changes.

packages/example-using-gatsby-source-github-graphql/gatsby-config.js renamed to examples/example-using-gatsby-source-github-graphql/gatsby-config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module.exports = {
66
siteMetadata: {
77
title: `Gatsby GitHub GraphQL Source`,
88
description: `Fetch data from GitHub and keep the connections and relationships between nodes.`,
9-
author: `@alexrintt`,
10-
siteUrl: `https://github.com/alexrintt/gatsby-source-github-graphql`,
9+
author: `@libsrcdev`,
10+
siteUrl: `https://github.com/libsrcdev/gatsby-source-github-graphql`,
1111
},
1212
plugins: [
1313
{
@@ -65,8 +65,8 @@ module.exports = {
6565
// Plugin to fetch all discussions of a repository and adding markdown features to the [discussion.body] field.
6666
resolve: `gatsby-source-github-graphql-discussions`,
6767
options: {
68-
owner: `alexrintt`,
69-
repo: `rintt`,
68+
owner: `libsrcdev`,
69+
repo: `gatsby-blog-example`,
7070
categorySlugs: [`Published`],
7171
},
7272
},
@@ -86,7 +86,7 @@ module.exports = {
8686
limit: 3,
8787

8888
// Target user account.
89-
login: `alexrintt`,
89+
login: `libsrcdev`,
9090

9191
// Wether or not should fetch only locked repos, remove or set to [null] to omit this filter.
9292
isLocked: false,

packages/example-using-gatsby-source-github-graphql/gatsby-node.js renamed to examples/example-using-gatsby-source-github-graphql/gatsby-node.js

File renamed without changes.

packages/example-using-gatsby-source-github-graphql/gatsby-ssr.js renamed to examples/example-using-gatsby-source-github-graphql/gatsby-ssr.js

File renamed without changes.

0 commit comments

Comments
 (0)