thheller / shadow-cljs

ClojureScript compilation made easy
https://github.com/thheller/shadow-cljs
Eclipse Public License 1.0
2.27k stars 179 forks source link

shadow-cljs server and tmux #234

Closed geraldodev closed 6 years ago

geraldodev commented 6 years ago

shadow-cljs server is the ice on the cake.

I have a tmux configuration that invokes 3 shadow-cljs

I'm commenting the processes that depend on the server process. It would be nice if these processes waited for the server process to be established and connect once it's live.

thheller commented 6 years ago

This stuff is a bit out of scope for shadow-cljs itself.

You can however do this quite simply with standard bash stuff. The server process will write a .shadow-cljs/server.pid file when its ready to be used. so you could write a wait-for-server.sh that just waits for that file and then wait-for-server.sh && shadow-cljs watch cards.

What you can also do is use clj-run.

(ns demo.runnable
  (:require
    [shadow.cljs.devtools.api :as shadow]))

(defn start
  {:shadow/requires-server true}
  [& args]
  (shadow/watch :cards)
  (shadow/repl :cards))

npx shadow-cljs clj-run demo.runnable/start

That is if you don't need 3 separate tmux terminals and just put them all into one.