Open kalebheitzman opened 3 years ago
Well, to be honest, I've been thinking about this recently while using the plugin for my work, and there's no clear answer yet.
The difficult part is that this plugin cannot run independently of the site as it depends on the fully Gatsby.js lifecycle.
I've considered providing a separate binary including Gatsby's default schema, but considering that the Gatsby Theme composition can be very heavy and complex, it is not a realistic solution. It only makes sense when it's all configured.
My suggestion would be to emit the type from the actual configured site, but give it an extra option to put output closer to the theme. (e.g. multiple outputs, near-file-preset, etc)
Or assuming that themes are usually managed in monorepo, the Gatsby site emitting types can be operated as a library.
Consider the following example:
Shipping types with a theme by changing the output directory and this correctly puts the types in the theme that I'm developing. Is there an option to make the schema and plugin documents output inside of the theme instead of the main/starter project. I'm loading this plugin from the theme as well.
I'm using yarn workspaces to develop the theme as suggested in the Gatsby docs.