Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-node-helpers

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-node-helpers - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.travis.yml

2

package.json
{
"name": "gatsby-node-helpers",
"version": "0.1.0",
"version": "0.1.1",
"description": "Gatsby node helper functions to aid node creation.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -29,2 +29,4 @@ # gatsby-node-helpers

Call `createNodeHelpers` with options.
```js

@@ -44,2 +46,4 @@ import createNodeHelpers from 'gatsby-node-helpers'

Call `createNodeFactory` with a type name.
```js

@@ -56,3 +60,3 @@ import createNodeHelpers from 'gatsby-node-helpers'

export const DocumentNode = createNodeFactory('DocumentNode')
export const ProductNode = createNodeFactory(`Product`)
```

@@ -62,17 +66,21 @@

`ProductNode` accepts an object and returns a new object to be passed to
Gatsby's `createNode` action creator.
It handles setting up Gatsby's internal fields, including the content digest
and node type.
```js
// gatsby-node.js
import { DocumentNode } from './nodes'
import { getAllDocuments } from './api'
import { ProductNode } from './nodes'
import { getAllProducts } from './api'
const documents = getAllDocuments()
exports.sourceNodes = async ({ boundActionCreators }) => {
const { createNode } = boundActionCreators
const documents = await getAllDocuments()
const products = await getAllProducts()
documents.forEach(document => {
const node = DocumentNode(document)
products.forEach(product => {
const node = ProductNode(product)
createNode(node)

@@ -86,1 +94,3 @@ })

Coming soon...
[gatsby-source-plugins]: https://www.gatsbyjs.org/docs/create-source-plugin/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc