-
Notifications
You must be signed in to change notification settings - Fork 62
Snippets
Andre R edited this page Jun 11, 2016
·
1 revision
Useful snippets
Even though goog.deps
provides the dependencies it can be useful to know the dependency graph given a cljs namespace. For instance if you have multiple builds.
(ns scratch.xy
(:require
[clojure.tools.namespace.find :as ctnf]
[clojure.tools.namespace.dir :as ctnd]
[clojure.tools.namespace.dependency :as ctndeps]
[clojure.tools.namespace.track :as ctnt]))
(def cljs-graph
(::ctnt/deps (ctnd/scan-dirs (ctnt/tracker) [(io/file "src" "cljs")] {:platform ctnf/cljs})))
(defn deps-graph [graph ns]
(let [deps (ctndeps/immediate-dependencies graph ns)]
{ns (mapv #(deps-graph graph %) deps)}))
(deps-graph cljs-graph 'your.ns.core)