|
3 | 3 | (:require [boot.core :as boot] |
4 | 4 | [boot.task.built-in :refer [repl]] |
5 | 5 | [boot.util :as util] |
| 6 | + [clojure.set :as set] |
6 | 7 | [clojure.java.io :as io] |
7 | | - [clojure.string :as str] |
8 | | - [dirac.agent.config :as dirac-conf])) |
| 8 | + [clojure.string :as str])) |
9 | 9 |
|
10 | | -(def ^:private deps '#{binaryage/devtools binaryage/dirac}) |
| 10 | +(def ^:private deps '{:cljs-devtools #{binaryage/devtools} :dirac #{binaryage/dirac}}) |
11 | 11 |
|
12 | 12 | (def ^:private preloads {:cljs-devtools 'devtools.preload :dirac 'dirac.runtime.preload}) |
13 | 13 |
|
|
24 | 24 | pr-str |
25 | 25 | ((partial spit out-file)))))) |
26 | 26 |
|
27 | | -(defn- assert-deps [] |
| 27 | +(defn- assert-deps [lib] |
28 | 28 | (let [current (->> (boot/get-env :dependencies) |
29 | 29 | (map first) |
30 | 30 | set) |
31 | | - missing (remove current deps)] |
| 31 | + missing (set/difference (get deps lib) current)] |
32 | 32 | (if (seq missing) |
33 | 33 | (util/warn (str "You are missing necessary dependencies for boot-cljs-repl.\n" |
34 | 34 | "Please add the following dependencies to your project:\n" |
|
58 | 58 | [b ids BUILD_IDS #{str} "Only inject devtools into these builds (= .cljs.edn files)"] |
59 | 59 | (let [tmp (boot/tmp-dir!) |
60 | 60 | prev (atom nil)] |
| 61 | + (assert-deps :cljs-devtools) |
61 | 62 | (comp |
62 | 63 | (boot/with-pre-wrap fileset |
63 | 64 | (doseq [f (relevant-cljs-edn @prev fileset ids)] |
|
84 | 85 | start-dirac-once (delay (start-dirac! dirac-opts))] |
85 | 86 | (util/dbug "Normalized nrepl-opts %s\n" nrepl-opts) |
86 | 87 | (util/dbug "Normalize dirac-opts %s\n"dirac-opts) |
87 | | - (assert-deps) |
| 88 | + (assert-deps :dirac) |
88 | 89 | (assert (= (:port nrepl-opts) (get-in dirac-opts [:nrepl-server :port])) |
89 | 90 | (format "Nrepl's :port (%s) and Dirac's [:nrepl-server :port] (%s) are not the same." |
90 | 91 | (:port nrepl-opts) (get-in dirac-opts [:nrepl-server :port]))) |
|
0 commit comments