-
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
Clarify GraphQL type ownership and permissions for themes #16529
Comments
Looks like naming themes with |
@stefanprobst Was always a requirement 😉 Just got codified in #16620 |
On a code level for defining theme features like shadowing and composition, the I believe the only way in which that is "special" is because of babel-related processing code. You can easily work around this with the es6-compile plugin though and we shouldn't add any more features that require this naming convention since that would distance further "themes" from "plugins" which are currently the same thing. |
I realize it's not enforced in code, but my understanding of #16620 and @sidharthachatterjee's comment was that it is a requirement by convention now. If not, we should not say so in the docs. Personally I do think we need something to distinguish themes from other plugins if we want to give them permissions that non-theme plugins don't have, like modifying types they don't own. |
The requirement for package names to contain This is not strictly about theme APIs (shadowing and gatsby-config composition). This was supposed to enable not only this for themes but also components / components library that aren't themes/plugins to ship with queries (mostly static queries) and allow users to import them without having to add them to plugin list. It probably make sense to merge list of packages that contain |
@pieh Why not find theme in gatsby-config.js and add it to all dependencies list manually ? |
@wangyi7099 what do you mean with find themes in gatsby-config? A theme = plugin and is part of the plugins list so it's hard to know exactly what a "theme" is. |
@wardpeet Hi I mean we can judge the plugin whether it is theme or not by finding all related |
|
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
I don't think this has been clarified. |
OK, so decision here is whether we want to have special kind of plugins that are themes or are all plugins created equal. It seems that @ChristopherBiscardi wants to not have any special theme treatment. However this conflicts with our restrictions of what plugins can do with different types. In a way, we might be just blocked because we don't have plugins do the types for themselves, instead of relying on inference. It could be that if plugins actually all provided types, then it would be okay without having an option to modify other types. We can also enable some type modification, eg when there is no type defined in owner plugin. Main idea we have for themes is that for "data abstraction types" there would be a child type defined that implements the abstraction interface anyway, so there is no reason to do type modification. |
I would just second that this is still a concern when building themes. The use case I have run into recently was trying to make sure the For example I have a field |
When building the GraphQL schema, we keep track of which types are created by which plugins. This information is used to prevent plugins from modifying types they do not own.
The exception to this is
default-site-plugin
, i.e. a user'sgatsby-node.js
, which is always allowed to modify types. When a type has been modified by a user, it is then owned by the user.We should clarify, how this should work with themes. Currently, to the schema builder a theme appears like any other plugin and is therefore not allowed to modify types owned by other plugins. For example, a theme's
gatsby-node.js
would not be allowed to modifyMdxFrontmatter
, which is owned bygatbsy-plugin-mdx
.Options:
gatsby-node
is not allowedgatsby-node
like a top-leveldefault-site-plugin
gatsby-node
the last two options would both require a way to differentiate a theme from other plugins -- by
gatsby-theme-*
naming convention or something else.personally, I opt for option 2+naming convention
/cc @freiksenet @ChristopherBiscardi
Related #15544
The text was updated successfully, but these errors were encountered: