chore: Optimise gatsby-node.js in gatsbygram example (#16407)
chore: Optimise gatsby-node.js in gatsbygram example (#16407)

The blog post for the case study about it has been updated recently (see #15577) and some improvements were suggested during the code review.

This is to reflect these improvements in the `gatsby-node.js` file in the example code, but basically:

- Use `reporter.panicOnBuild` API in case of errors executing the GraphQL query
- Remove the use of `lodash` and replace it by native `.forEach()`
gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby