async function generateConsumerMatrix(graphql) {
  const allMarkdown = await graphql(`
    {
      allMarkdownRemark {
        edges {
          node {
            fileRelativePath
            frontmatter {
              consumes {
                file
                details
              }
            }
          }
        }
      }
    }
  `)
  let consumerMatrix = allMarkdown.data.allMarkdownRemark.edges.reduce((consumers, { node }) => {
    if (!node.frontmatter.consumes || node.frontmatter.consumes.length <= 0) return consumers
    consumers[node.fileRelativePath] = node.frontmatter.consumes
    return consumers
  }, {})
  if (!consumerMatrix) consumerMatrix = {}
  fs.writeFileSync('./static/consumers.json', JSON.stringify(consumerMatrix))
}
// generate a JSON file that identifies which libraries a given document depends on
generate a JSON file that identifies which libraries a given document depends on
generate a JSON file that identifies which libraries a given document depends on
async function generateConsumerMatrix(graphql) {
  const allMarkdown = await graphql(`
    {
      allMarkdownRemark {
        edges {
          node {
            fileRelativePath
            frontmatter {
              consumes {
                file
                details
              }
            }
          }
        }
      }
    }
  `)
  let consumerMatrix = allMarkdown.data.allMarkdownRemark.edges.reduce((consumers, { node }) => {
    if (!node.frontmatter.consumes || node.frontmatter.consumes.length <= 0) return consumers
    consumers[node.fileRelativePath] = node.frontmatter.consumes
    return consumers
  }, {})
  if (!consumerMatrix) consumerMatrix = {}
  fs.writeFileSync('./static/consumers.json', JSON.stringify(consumerMatrix))
}
async function generateConsumerMatrix ( graphql ) { const allMarkdown = await graphql ( ` ` ) let consumerMatrix = allMarkdown . data . allMarkdownRemark . edges . reduce ( ( consumers , { node } ) => { if ( ! node . frontmatter . consumes || node . frontmatter . consumes . length <= 0 ) return consumers consumers [ node . fileRelativePath ] = node . frontmatter . consumes return consumers } , { } ) if ( ! consumerMatrix ) consumerMatrix = { } fs . writeFileSync ( './static/consumers.json' , JSON . stringify ( consumerMatrix ) ) }
generate a JSON file that identifies which libraries a given document depends on
generate a JSON file that identifies which libraries a given document depends on