Fork me on GitHub
#boot
<
2017-02-27
>
qqq04:02:05

I have a boot cljs project building both :optimizations :none and :optimiozations :advanced. I want (dirac.runtime/install!) + (devtools.core/install!) + dependencies to ONLY be in the :opt-none build, and NOT in the :opt-advanced build. How can I configure this?

kommen12:02:09

I have a cljs project with with node js as the target. for development, how can I run node with boot.util/sh after the project is built, but only once, so that node isn’t started every time a file changes and watch triggers?

pesterhazy12:02:11

so when do you want to shell out to node?

pesterhazy12:02:21

can you post your pipeline?

kommen13:02:13

@pesterhazy this is my pipeline

kommen13:02:17

(def backend-target "/build/backend")

(deftask backend-dev []
  (merge-env! :source-paths ["clj/backend/src"])
  (comp
   (with-post-wrap fileset
     (binding [*sh-dir* backend-target]
       (sh "node" "backend"))
     fileset)
   (watch)
   (reload :ids ["backend"] :on-jsload 'backend.core/main :port 7890 :disable-hud true)
   (cljs :ids ["backend"])
   (target :dir #{backend-target})))

pesterhazy13:02:58

what happens, and what would you prefer to happen?

kommen13:02:56

with this, (sh "node" “backend”)) is never executed. And I would expect it to be executed once after target has written the fileset the first time to backend-target

pesterhazy13:02:43

yeah that won't work because watch starts a loop of the following tasks, and it's an infinite loop

pesterhazy13:02:21

what you can do is

pesterhazy13:02:05

to create a task with a delay which derefs that delay, and add that task at the end of the pipeline

pesterhazy13:02:37

that way, the body of the delay will only be executed once, i.e. after your target dir was written

pesterhazy13:02:54

(deftask run-node [] (let [d (delay (sh "node" ..))] (with-pass-thru [_] @delay)))

kommen14:02:23

@pesterhazy thanks! that worked

pesterhazy14:02:53

do you have boot-reload working with node?

kommen14:02:36

well, it worked at some point, but it looks like it’s broken right now for me here

pesterhazy14:02:13

interesting, does it work with websockets, just like in the browser?

pesterhazy14:02:56

cool I should check it out sometime

richiardiandrea16:02:59

It would be great if boot-figreload works with node as well

kommen16:02:51

@pesterhazy I can’t figure out if/how reload would have ever worked for me with nodejs. maybe I’m just confusing with having it working with figwheel. (I just moved the whole project from lein to boot)

pesterhazy16:02:51

I mean with node and lumo I can now just attach using the socket repl, which works ok