sistema-lens

0.0.1 • Public • Published

sistema-lens

This package visualise the dependency graph of a sistema registry. It helps understanding the code in a visual way.

graph

How to use it

The dependency graph is a self contained interactive HTML file that is returned by lens. Here's an example on how to use it with express:

const express = require("express");
const lens = require("sistema-lens");

const app = express();

app.get("/", (req, res) => {
  res.send(
    lens(
      d.getAdjacencyList(),
      new Map([
        [a, "Info about a"],
        [b, "Info about b"],
        [c, "Info about c"],
        [d, "Info about d"],
      ]),
      { title: "Test Lens" }
    )
  );
});

app.listen(3000, () => console.log("Listening at: http://localhost:3000"));

The HTML displays an interactive representation of the dependency graph. lens takes 3 arguments:

  • an adjacency list as returned by the getAdjacencyList function or methods in sistema
  • a map of dependencies and strings to enrich the graph of information
  • an option object that allows to set the title of the page

graph2

Different usages

getAdjacencyList in sistema allows to list:

  • all dependencies required for returning a specific one (getAdjacencyList as a dependency method)
  • all graph of dependencies belonging to a context (getAdjacencyList as a context method)
  • any combination of dependencies using the getAdjacencyList function

Package Sidebar

Install

npm i sistema-lens

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

136 kB

Total Files

11

Last publish

Collaborators

  • sithmel