From b8050068d75ce5070cb42b315bfd86da17d9aa8c Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 12 Dec 2019 01:02:04 +0100 Subject: [PATCH] :tada: Add node repl to tools.clj script. --- frontend/tools.clj | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/frontend/tools.clj b/frontend/tools.clj index 8577970a0..2196a286c 100644 --- a/frontend/tools.clj +++ b/frontend/tools.clj @@ -1,8 +1,16 @@ (require '[clojure.pprint :refer [pprint]]) (require '[clojure.java.shell :as shell]) (require '[figwheel.main.api :as figwheel]) -(require '[cljs.build.api :as api]) (require '[environ.core :refer [env]]) +(require '[cljs.build.api :as api] + '[cljs.repl :as repl] + '[cljs.repl.node :as node]) +(require '[rebel-readline.core] + '[rebel-readline.clojure.main] + '[rebel-readline.clojure.line-reader] + '[rebel-readline.clojure.service.local] + '[rebel-readline.cljs.service.local] + '[rebel-readline.cljs.repl]) (defmulti task first) @@ -126,6 +134,18 @@ (task ["dbg-dist:main"]) (task ["dbg-dist:worker"])) +(defmethod task "repl:node" + [args] + (rebel-readline.core/with-line-reader + (rebel-readline.clojure.line-reader/create + (rebel-readline.cljs.service.local/create)) + (cljs.repl/repl + (node/repl-env) + :prompt (fn []) ;; prompt is handled by line-reader + :read (rebel-readline.cljs.repl/create-repl-read) + :output-dir "out" + :cache-analysis false))) + ;; --- Tests Tasks (defmethod task "build:tests"