Skip to content

Generates dot markup (Graphviz) visualizing an entire Contentful space's structured content. This repo's code is accompanying a blog post of mine regarding the subject.

License

Notifications You must be signed in to change notification settings

DanweDE/contentful-content-graphs-graphviz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains code accompanying my blog post about generating directed graphs using Graphviz visualizing a Contentful space's structured content (entries and assets).

Example

Have a look at the examples folder for an already exported Contentful space containing the Contentful example apps space data. This json file can used to try this tool without you exporting your own space data first:

node src/index.js examples/space.cf-example-app.json | dot -o graph.svg -T svg -K neato

graph.svg:

Graph of Contentful example app

Working with the code

First, download this repository and install all dependencies:

git clone https://github.com/DanweDE/contentful-content-graphs-graphviz.git
cd contentful-content-graphs-graphviz
npm install

To better follow the blog post you can checkout the respective branch for each step, e.g. git checkout blog-post/step-3.

Exporting a Contentful space

To export a Contentful space of your choice to work with, run

node util/export-space.js --file=space.json --space=CF_SPACE_ID --token=CF_CMA_TOKEN

or use the Contentful export tool cli directly.

Generating dot (Graphviz) markup

With the space.json created in this folder you can run:

node src/index.js space.json

This takes the previous step's space.json and prints the dot markup for a graph.

Drawing the graph

The generated dot markup can either be copy pasted to viz-js.com or it can be processed by a local Graphviz installation:

node src/index.js | dot -o graph.svg -T svg -K dot

Instead of -K dot any other Graphviz layout engine like neato, fdp or circo can be used to influence the layout of the generated graph.

About

Generates dot markup (Graphviz) visualizing an entire Contentful space's structured content. This repo's code is accompanying a blog post of mine regarding the subject.

Resources

License

Stars

Watchers

Forks

Packages

No packages published