clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Helins 2021-04-03T12:41:16.460Z

Do you ever get out of memory exceptions when running generative tests on node? I am noticing more and more that a generative test than is quite all right on the JVM (eg. runs in 20 seconds without any memory adjustment) becomes really bloated when run on node (eg. now takes several minutes and explicitly needs more memory with --max_old_space_size)

indy 2021-04-05T15:48:13.479600Z

Which version of node are you using? Node 14 solved some memory issues we had

zackteo 2021-04-03T13:39:51.462500Z

@nilern @thheller Hello 🙂 I went through quickstart guide - https://github.com/thheller/shadow-cljs#quick-start as mentioned. But admittedly I am not too sure where I should continue from there 😅, do y'all have any suggestions? If not no worries, I'll try to figure something out!

thheller 2021-04-03T13:58:29.462800Z

what in particular are you looking to do? I mean did you chose a libray/framework yet or do you just want to test a few things?

zackteo 2021-04-03T14:02:54.463Z

Hmmm, I have a good idea of what libraries I am planning to use already. Have been thinking reagent with re-frame for stability (building a final year project for a company) and most examples/references. I considered rum after looking at it for awhile but seems like both are similarly stable and it wouldn't make a huge difference/benefit to go to rum instead

zackteo 2021-04-03T14:04:15.463200Z

Am specifically building a frontend interface to input constraints (be it check-boxes or sliders) and based on that state, send it as a query to the clojure backend

thheller 2021-04-03T14:05:04.463400Z

https://github.com/thheller/shadow-cljs#video-courses

thheller 2021-04-03T14:05:58.463800Z

the setup videos are free, maybe those help

thheller 2021-04-03T14:06:16.464Z

or maybe use the re-frame template and compare what it generated vs. the raw setup you have now

zackteo 2021-04-03T14:07:21.464200Z

Hmmm okay okay! I'll start from there 🙂 Thanks!

Max 2021-04-03T15:51:03.467100Z

As I’ve worked on my small reagent/shadow-cljs side-project, I’ve noticed the split between my repl and my actual app more and more, especially while debugging. The repl is fine for testing functions in isolation, but being able to inspect my app’s state (without resorting to prn debugging) would be really nice. Is there a (reasonable) way to connect a repl to an actual app? Or would that take me far off the beaten path?

thheller 2021-04-03T15:57:18.467700Z

@max.r.rothman pretty much all targets support a REPL? how are you using the REPL now?

thheller 2021-04-03T15:59:21.468200Z

shadow-cljs watch app and then separately shadow-cljs cljs-repl app would give you a REPL into the app build for example

Max 2021-04-03T16:06:45.468800Z

I’ve got this in my shadow-cljs.edn:

:dev-http {8080 "public"}

 :builds
 {:frontend {:target :browser
             :modules {:main {:init-fn myapp.main/init}}}}
I typically launch a repl using Calva, which appears to be running this command:
npx shadow-cljs -d cider/cider-nrepl:0.25.8 watch :frontend
After it completes the build, it asks me which repl to start, giving me an option between node, browser, and my build. Selecting “browser” open a tab that says “Code entered in a browser-repl prompt will be evaluated here.“. I’m very much new to cljs, and definitely don’t understand how all the pieces fit together yet, so I really appreciate the help!

thheller 2021-04-03T16:07:55.469Z

select your build, not browser

thheller 2021-04-03T16:08:22.469200Z

browser is just a plain standalone REPL, if you select frontend it'll be your build

Ralii 2021-04-03T16:11:07.469400Z

Lol I didnt realize this either. Ty vm!

Max 2021-04-03T16:12:11.469600Z

I hadn’t been using that because when I try, my repl says “No available JS runtime” and links to a troubleshooting doc. I read through the doc and didn’t see anything that seemed relevant (to my newbie eyes), figured I had done something wrong, and went back to the plain browser option

Max 2021-04-03T16:12:19.469800Z

is there a way to get that to work?

djblue 2021-04-03T16:12:43.470Z

Also, you can (tap> value)https://clojuredocs.org/clojure.core/tap%3Eand view the data in the shadow-cljs inspector (http://localhost:9630/inspect) which really helps as your app state starts to grow.

thheller 2021-04-03T16:13:17.470200Z

No available JS runtime means that you need to open <http://localhost:8080> in the browser first. it is your app you want to REPL into so you need to load your app in the browser

thheller 2021-04-03T16:13:22.470400Z

pretty straightforward 😛

Max 2021-04-03T16:17:39.470700Z

🤦 of course. That works perfectly, thanks for the help!

Max 2021-04-03T16:18:33.470900Z

the inspector is new to me, that looks really useful!

💯 1