-
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
Add an example to the sourceNodes docs #8585
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.
Looks good to me!
* } | ||
* | ||
* const nodeContent = JSON.stringify(myData) | ||
* const nodeContentDigest = crypto |
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.
Unrelated, but I think you mentioned it too... we use this algorithm all over the place, so it's probably worth passing that to various APIs or something, e.g.
const createContentDigest = obj => crypto
.createHash(`md5`)
.update(obj)
.digest(`hex`)
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.
👍 to that, here's an issue #8587
* 'master' of github.com:gatsbyjs/gatsby: Add blog post on v2 reach router (gatsbyjs#8508) feat: add self to community page (gatsbyjs#8572) feat: update sites.yml (gatsbyjs#8589) Add an example to the sourceNodes docs (gatsbyjs#8585) chore(release): Publish fix: add compat fix for gatsby-cli v2 with gatsby v1 (gatsbyjs#8581) fix: fix unhandled rejection when no browser found when running with --open flag (gatsbyjs#8507) Fix writing out new page information (so new pages hot reload) during development (gatsbyjs#8570) Run coverage at the end of jest and configure thresholds (gatsbyjs#8371) chore(release): Publish chore: update gatsby-source-drupal version in using-drupal example (gatsbyjs#8497) Typo fix in gatsby-source-graphql/README.md (gatsbyjs#8562)
Add usable example code to the sourceNodes API docs. The aim is to show the essentials of sourcing / creating a node without trying to do anything fancy or clever.
Refs: https://twitter.com/xjamundx/status/1045036899646111744?s=19
Thanks @octalmage for linking to https://github.com/jamesdanylik/gatsby-source-git-commit/blob/master/gatsby-node.js, I adapted my first version based on some of the ideas in there. Thanks @LekoArts for the review in Discord :)