-
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
feat(gatsby): graphql engine #33030
feat(gatsby): graphql engine #33030
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a bunch of comments, mostly for clarification as I'm not familiar with the code of this feature. If you feel that some comments should be handled in a follow-up to get this shipped, I'm 100% ok with that.
packages/gatsby-plugin-utils/src/utils/plugin-options-schema-joi-type.ts
Show resolved
Hide resolved
|
||
// Emit file that imports required node APIs | ||
const schemaCustomizationPluginsPath = | ||
process.cwd() + `/.cache/query-engine-plugins.js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we usually don't use process.cwd() perhaps we need a global getter for program.directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do it all over the place in the codebase. I think it makes sense to add such utility and refactor in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This feature seems very useful for Gatsby. Does somebody can make a useful test-case example for the doc to understand the power of this feature? I thought to get the generation pages' data on backend-side with graphql-engine from the browser via a simple js fetch api call which will display a list of all the available images generated by the website by example (with maybe on action-click on an image displaying size and image infos) all that without any graphql code generated and bundled like before. .. some other thoughts? |
@simonjoom This is an internal feature designed to be used during SSR and DSG, rather than something designed for use elsewhere. I made a proof of concept, but it's not something for production: https://github.com/netlify/gatsby-4-demo/blob/main/example/functions/graphql/graphql.ts |
Description
The new experimental feature: standalone graphql engine (can be required in any node script to run GraphQL queries). Bundles all necessary dependencies using webpack and uses underlying lmdb datastore to access data.
Example usage (after initial
gatsby build
):[ch37492]