Fork me on GitHub
#boot
<
2017-11-14
>
sundbp10:11:35

Hi. I’m thinking of writing some CLI tools in clojurescript targeting node.js. That seems very possible and I have a couple of examples at hand (clack, closh, ..). I don’t have any example using boot as build tool though. Anyone aware of a nice cli tool project using boot targeting node.js?

jcf12:11:10

Has anyone encountered Boot pulling in the wrong version of tools.namespace?

Classpath conflict: org.clojure/tools.namespace version 0.2.11 already loaded, ALSO loading version 0.3.0-alpha4
I have an explicit dependency on 0.3.0-alpha4 in my :dependencies, and have excluded tools.namespace everywhere it's required but I'm still somehow getting the older version, which messes up compiling Clojurescript in my project.

jcf12:11:42

0.2.11 doesn't show up in the output from boot show -d.

jcf12:11:25

It's coming from my profile.boot. Commenting everything out in there fixes things. Also the warning doesn't show up during CI. I guess boot show -d ignores some of what's in profile.boot.

borkdude13:11:56

@sundbp If you find a good example, I also would like to know. Most things I’ve seen use lein + figwheel for node

sundbp13:11:21

yeah. i sort of gave up for right now and may try lein-figwheel way as a start.

sundbp13:11:33

yup, but struggled to see how the node case is to be set up

borkdude13:11:50

Maybe contact some of the authors

borkdude13:11:35

You can also start without the reloading. I guess the reloading is only useful when you have some long running process in your node process, like a webserver?

sundbp13:11:15

i’m really just looking for a boot based workflow with a nice way to connect my repl

borkdude13:11:17

I do have a project like that myself

sundbp13:11:38

cool - link?

sundbp13:11:54

(i don’t care about the reloading part at all)

borkdude13:11:40

I have a setup like this: cljs compiles node, Gulpfile watches js, re-runs node which produces some html

borkdude13:11:05

so I don’t use a REPL there, the node process terminates too fast for a REPL to make sense

sundbp13:11:35

ok. well, I really just want a good REPL experience to iterate on some node based cli tools..

borkdude13:11:03

I’m not sure what that looks like. A CLI tool isn’t long running right

borkdude13:11:16

so what would you want to do in the REPL then

sundbp13:11:28

I grow my code in my repl.

borkdude13:11:52

What is the REPL connected to if it’s a CLI tool that terminates fast?

sundbp13:11:28

the tool would terminate fast when running independently, but a REPL with the tool’s namespaces available can run forever.

borkdude13:11:58

so the REPL is preventing the process from quitting?

sundbp14:11:00

it’s connected to a process which does nothing but have a repl

borkdude14:11:05

I guess I should look into it myself more then

sundbp14:11:14

it’s not like my clojure REPLs are running the exact same thing as the prod version would. it’s just a REPL that loads some NS and from there executes code as per the repl. I’m looking for the same for node

borkdude14:11:55

I see how it works now, having tried https://github.com/malyn/figwheel-node-template - very cool

borkdude14:11:01

I’ve got boot-figreload + node working now

borkdude14:11:22

@sundbp Can I PM my code to you somewhere? Don’t want to flood this channel and I don’t have it on Github

sundbp14:11:15

sure. i’m on <mailto:[email protected]|[email protected]>, but you can laso just PM me here on slack.

hlolli15:11:23

is there a builtin task to delete the target directory, if it exists?

dave15:11:32

@hlolli depending on what you're trying to do, you could just omit the target task so that the directory doesn't get written?

hlolli15:11:52

I want it to be written, I see that some functions in a task are called ahead of the tasks, it's just about timeing, because I want to find out if a file exists within these directories during compilation to prevent conflicts.

hlolli15:11:26

before all starts I'd preferably like to have an empty directory called target

alandipert15:11:33

hlolli (with-pass-thru _ (dosh "mkdir", "-p", "target")) is a little anonymous task that will do it. just put in pipeline

alandipert15:11:01

maybe add another dosh call that does an rm

hlolli15:11:00

ok ok thanks, I wanted to know if it already existed before doing it, like lein clean.

qqq16:11:29

when I run boot remote-client-dev, I get:

Writing adzerk/boot_reload.cljs to connect to ...
Writing main.cljs.edn...
Compiling ClojureScript...
• main.js
Compile sources, elapsed time: 4899.99279 msecs
Compile sources, elapsed time: 33.606849 msecs
                                       java.lang.Thread.run                  Thread.java:  748
         java.util.concurrent.ThreadPoolExecutor$Worker.run      ThreadPoolExecutor.java:  624
          java.util.concurrent.ThreadPoolExecutor.runWorker      ThreadPoolExecutor.java: 1149
                        java.util.concurrent.FutureTask.run              FutureTask.java:  266
                                                        ...                                   
                        clojure.core/binding-conveyor-fn/fn                     core.clj: 2027
                              adzerk.boot-cljs/compile-1/fn                boot_cljs.clj:  160
                                   adzerk.boot-cljs/compile                boot_cljs.clj:   72
                                          boot.pod/call-in*                      pod.clj:  413
                                                        ...                                   
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java:  102
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java:  109
                                                        ...                                   
                                          boot.pod/call-in*                      pod.clj:  410
                                      boot.pod/eval-fn-call                      pod.clj:  359
                                         clojure.core/apply                     core.clj:  657
                                                        ...                                   
                         adzerk.boot-cljs.impl/compile-cljs                     impl.clj:  156
                            adzerk.boot-cljs.impl/dep-order                     impl.clj:   36
               adzerk.boot-cljs.impl/cljs-depdendency-graph                     impl.clj:   29
                                        clojure.core/reduce                     core.clj: 6753
                                clojure.core.protocols/fn/G                protocols.clj:   13
                                  clojure.core.protocols/fn                protocols.clj:   75
                         clojure.core.protocols/iter-reduce                protocols.clj:   49
            adzerk.boot-cljs.impl/cljs-depdendency-graph/fn                     impl.clj:   30
                      adzerk.boot-cljs.impl/ns-dependencies                     impl.clj:   23
                                  cljs.analyzer.api/find-ns                     api.cljc:  163
java.lang.AssertionError: Assert failed: (symbol? sym)
Elapsed time: 13.816 sec
is there anyway to get more info on "where exactly is this assertion happening" if it's due to my code (I suspect not) -- and if it's due to cljs/boot internal code, is it possible to get the name of the namespace it was processing when this happened ? as of right now, I have no where the error is coming from