The `gatsby-node-helpers` package provides a set of utility functions specifically designed to simplify and streamline the process of creating Gatsby nodes within source plugins. Its current stable version is 1.2.1. While not adhering to a strict time-based release cadence, the project actively publishes updates, with recent releases addressing feature enhancements and minor adjustments. It differentiates itself by abstracting away the complexities of Gatsby's internal node requirements, such as automatically generating `contentDigest`, handling Gatsby's reserved field conflicts through intelligent namespacing, and providing compliant functions for generating type names and unique IDs. This significantly streamlines the development of Gatsby source plugins by ensuring created nodes adhere to Gatsby's internal data model, reducing boilerplate and common errors associated with manual node creation in `gatsby-node.js` files.
npm install gatsby-node-helpersVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing `createNodeHelpers` and using `createNodeFactory` to prepare product data for Gatsby's `createNode` action within the `sourceNodes` API.
If you relied on the exact string format of generated node IDs for types containing non-camelCase characters (e.g., `shareable_link`), update any hardcoded references or logic that expects the old format. The new format will camelCase such types (e.g., `ShareableLink`).
If your `createNodeFactory` middleware is `async`, make sure to use `const myNode = await MyNodeType(nodeData)` instead of `const myNode = MyNodeType(nodeData)` to correctly resolve the promise before calling `createNode(myNode)`.
Always pass `gatsbyArgs.createNodeId` and `gatsbyArgs.createContentDigest` when initializing `createNodeHelpers`. Example: `createNodeHelpers({ typePrefix: 'MyPrefix', createNodeId, createContentDigest })`.Ensure `const { actions } = gatsbyArgs; const { createNode } = actions;` or directly `gatsbyArgs.actions.createNode(node)`.Use `import { createNodeHelpers } from 'gatsby-node-helpers'` at the top of your `gatsby-node.js` or `gatsby-node.ts` file.Install `@types/gatsby` (`npm install --save-dev @types/gatsby`) and ensure your `gatsby` peer dependency meets the `gatsby-node-helpers` requirements (e.g., `>=2.29`).