Code Monkey home page Code Monkey logo

clj-hiera's Introduction

clj-hiera

Generates a graph of the dependency hierarchy of a set of clojure files. This uses the clojure.tools.namespace library for namespace parsing and Rhizome for graph generation using Graphviz.

This tool was originally inspired by lein-ns-dep-graph, but has many additional options for graph generation.

Usage

There are a few different ways to use clj-hiera. First, you'll need Graphviz installed in order to generate the images. Check your local package manager:

# Debian/Ubuntu:
sudo apt-get install graphviz

# OS X with Homebrew:
brew install graphviz

Deps Alias

If you're using tools.deps, you can use this by adding an alias to your deps.edn file:

:hiera
{:deps {io.github.greglook/clj-hiera {:git/tag "2.0.0", :git/sha "b14e514"}}
 :exec-fn hiera.main/graph
 :exec-args {,,,}}

To generate namespace graphs:

clj -X:hiera [opts]

Clojure Tool

Alternately, you can use this as a standalone Clojure tool:

clj -Ttools install-latest :lib io.github.greglook/clj-hiera :as hiera

Then, to invoke the tool in any Clojure project:

clj -Thiera graph [opts]

Leiningen

For Leiningen, you can use this via the lein-hiera plugin. Add the following to your project.clj file or user-level profile:

[lein-hiera "2.0.0"]

Then you can run:

lein hiera [opts]

Options

The available options, and their default values are:

name default description
:sources #{"src"} Set of directories containing source files to analyze.
:output "target/hiera" Directory to write files to.
:layout :vertical Whether to lay out the graph vertically or horizontally.
:cluster-depth 0 Number of namespace segments to cluster nodes by.
:external false Show external namespaces as nodes in the graph.
:ignore #{} A set of namespace prefixes or patterns to exclude from the graph.

When using Leiningen, graph generation options may be provided under the :hiera key in the project map. You can also provide/override the configuration options by specifying them on the command line with keyword arguments:

lein hiera :cluster-depth 3 :layout :horizontal

Example

This image shows the dependency hierarchy from a moderately complex project. The namespaces are clustered by two levels, and it shows a dependency on the external puget library.

Example dependency hierarchy

License

This is free and unencumbered software released into the public domain. See the UNLICENSE file for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.