From f6cc594a99895e961aac44bfb578c19b3e53e456 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Fri, 12 Jun 2020 00:49:07 -0700 Subject: [PATCH] feat: Add node for button component --- plugins/gatsby-source-nr1-sdk/gatsby-node.js | 24 +++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/plugins/gatsby-source-nr1-sdk/gatsby-node.js b/plugins/gatsby-source-nr1-sdk/gatsby-node.js index 7d8f762a0..a020cda4a 100644 --- a/plugins/gatsby-source-nr1-sdk/gatsby-node.js +++ b/plugins/gatsby-source-nr1-sdk/gatsby-node.js @@ -1,9 +1,27 @@ const loadSdk = require('./loadSdk'); -exports.sourceNodes = async ({ actions }, { release }) => { - // const { createNode } = actions; +exports.sourceNodes = async ( + { actions, createNodeId, createContentDigest }, + { release } +) => { + const { createNode } = actions; const sdk = await loadSdk(release); + const { Button } = sdk; - console.log(sdk); + const data = { + name: 'Button', + description: Button.__docs__.text, + }; + + createNode({ + ...data, + id: createNodeId('NR1SdkComponent-Button'), + parent: null, + children: [], + internal: { + type: 'NR1SdkComponent', + contentDigest: createContentDigest(data), + }, + }); };