-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[docs] Improve documentation for plugin authors #4266
Comments
This looks fantastic! Let me know how I can help! |
Looks good! I was thinking about building a "gatsby-plugin-starter" repo, but haven't had the time. I like the idea of a CLI to handle that too. |
- Link to plugin docs - Link to API spec re gatsbyjs#4266
@KyleAMathews I'll probably need your help double-checking the API/naming conventions write-ups to make sure I didn't miss anything. @markmichon A starter repo would be fantastic, but I wonder if we'd need multiple versions? For example, a plugin to add third-party code (e.g. Google Analytics) is really different from a transformer or a data source plugin. 😕 (That's why I put this in the long term category. 😂) |
I've got a PR started at #4272 to tackle the short-term changes. Any feedback is welcome as I work toward getting this done. |
@KyleAMathews can a plugin provide a |
When/how is |
If I'm in the right place in the code, it looks like This also appears to answer my previous question about |
- removes local plugin docs - adds link to plugin authoring (where local plugin docs were moved) re gatsbyjs#4266
- add naming convention explanations and examples - add core plugin concepts as bullet points - add list of files Gatsby tries to find in a plugin - explain local plugin development re gatsbyjs#4266
in your
this is not gatsby specific - just normal module export |
#4272 is ready for review. Only thing left to add is the boilerplate README, which might actually make more sense in a starter repo. It feels like it wouldn't fit on the docs page right now; would love some feedback on this. |
In #2586 in comments I tried to explain base concepts of data sourcing and how it ties into gatsby graphql layer ( #2586 (comment) ) and provided examples that use demo REST api ( https://jsonplaceholder.typicode.com/ - #2586 (comment) and #2586 (comment) ). I think some of it (mostly examples as I'm not good writer) might be used to update Create a source plugin page with real live (ish) use of related APIs. What is missing there and I feel is important is fetching assets (for example images) from remote urls. Demo REST api I used there do have endpoint which point to images ( https://jsonplaceholder.typicode.com/photos ) and I can adjust examples to use |
- Add link to “create a source plugin” docs - Clarify optional vs. required files - Clarify how `package.json` works and what default values are - Clean up local plugin `gatsby-config.js` note - Remove duplicate explanation of `package.json` re gatsbyjs#4266
- Clarify that plugins can run as npm packages or local files re gatsbyjs#4266
No — plugins can have sub-plugins e.g. all the gatsby-remark-* plugins. I thought about doing this but decided this would add a lot of complexity around issues like you mentioned. We'll probably need this for themes though so will need to address this when we start work on them. |
It's not. Node module resolution requires a directory to have an index.js or something in the Plugins can have something in index.js like gatsby-source-contentful if you want to export helper functions for other plugins to use e.g. gatsby-source-filesystem does the same thing https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-filesystem/src/index.js |
oh, @pieh already answered these haha 😅 In the mouth of two or three witnesses... |
- remove reference to plugins being “easy” - build off @robwierzbowski’s wording - add examples of what plugins can do re gatsbyjs#4266
- update wording per @KyleAMathews feedback - clarify transformer description - link to example plugins - fix grammar mistakes re gatsbyjs#4266
* docs: add links for plugin authors - Link to plugin docs - Link to API spec re #4266 * docs: create a “plugin authoring” page re #4266 * docs: move authoring docs to authoring page - removes local plugin docs - adds link to plugin authoring (where local plugin docs were moved) re #4266 * docs: write plugin authoring docs - add naming convention explanations and examples - add core plugin concepts as bullet points - add list of files Gatsby tries to find in a plugin - explain local plugin development re #4266 * docs: clean up plugin authoring docs - Add link to “create a source plugin” docs - Clarify optional vs. required files - Clarify how `package.json` works and what default values are - Clean up local plugin `gatsby-config.js` note - Remove duplicate explanation of `package.json` re #4266 * docs: clarify npm package core concept - Clarify that plugins can run as npm packages or local files re #4266 * Add missing word * docs: improve opening paragraph - remove reference to plugins being “easy” - build off @robwierzbowski’s wording - add examples of what plugins can do re #4266 * docs: clarify and clean up - update wording per @KyleAMathews feedback - clarify transformer description - link to example plugins - fix grammar mistakes re #4266 * docs: improve wording around plugin documentation re #4266 * docs: minor tweaks * Reverse order as extending far more common
Hi @jlengstorf just revisiting this. I was thinking of closing this issue and creating new issues that mirror the checklist you have above in [EPIC] v2.0 plugin library and [EPIC] v3.0 plugin library like so.
[EPIC] v2.0 plugin library
[EPIC] v3.0 plugin library
And could this one get added to @ChristopherBiscardi's project?
Let me know if you'd like the Peril issues to belong to a different epic instead, or any feedback you have on this proposed change. |
@shannonbux The CLI stuff is captured in #6729, so I don't think that needs to be added to anyone's work. The README template looks great. I think you can close that out. I think the other organization you're suggesting looks good, too. Feel free to move things around and close this out. Thanks! |
Ok, all those suggestions are implemented now, @jlengstorf! Thanks! |
Currently, the documentation for plugin authors is pretty sparse. On the contributing page, there's a single paragraph, and the plugins section of the docs is super high-level.
What I'm proposing in the short term
The docs should be updated to:
gatsby-plugin-*
vsgatsby-transformer-*
?)What I'm proposing in the medium term
What I'm proposing in the long term
Did I miss anything here? I can get started on the short-term updates right away — would love to get any feedback from other folks who've written plugins:
This may need to be pulled into a project — "Improve the Plugin Discovery and Authoring Experience" — or maybe we can solve it all in a few issues.
What do you think?
The text was updated successfully, but these errors were encountered: