Fork me on GitHub
#beginners
<
2024-02-18
>
Jee Lee09:02:40

I have a quick question. I'm trying to setup my project. I setup deps.edn for backend and I can start the repl from emacs (doom emacs, cider-jack-in-clj) no problem. Now I'm looking to setup frontend environment in the same project with shadow-cljs. So I setup shadow-cljs.edn with :deps pointing to :aliases in deps.edn as shown on shadow-cljs user guide. Now my question is... how do I start both clj repl and cljs repl from doom emacs? I start the backend with cider-jack-in-cli and try to start the cljs repl with cider-jack-in-cljs and it always asks me

A CIDER session with the same connection parameters already exists (....:localhost:36721). Are you sure you want to create a new session instead of using `cider-connect-sibling-clj(s)'?

Jee Lee09:02:59

If I say no... nothing happens. If I start the new session, I can't seem to connect (eval code by C-c C-c)

No cljs REPLs in current session "...:localhost:35683"

Jee Lee09:02:58

I found cider-jack-in-clj&cljs which seems to be something I'm looking for but now it's saying it can't find ClojureScript

error in process filter: if: ClojureScript is not available.  See  for details
error in process filter: ClojureScript is not available.  See  for details

vemv10:02:00

Try performing cider-jack-in-clj&cljs over https://github.com/reducecombine/icd.scroll which is a sample, small project. When it asks for a project type, select shadow When it asks whether it should open a browser, select y (very important to get cljs eval)

vemv10:02:13

You can also, in the same project, run make and then cider-connect-clj&cljs If those work, it's an issue in your repo, else you might need to install npm, or perhaps make it available into emacs

Jee Lee15:02:44

Thank you so much. Looking through the project, I thought my :paths were perhaps the problem. I had "src/clj" and "src/cljs" and folder structures like src/clj/myproj/system.clj and src/cljs/myproj/core.cljs. Once I restructured the project to src/backend/system.clj and src/client/core.cljs, and also shortening my :paths to just "src". I was able to start shadow-cljs watch app.

Jee Lee15:02:59

so that must have been the problem. In emacs, I have to cider-jack-in-cljs first with shadow-cljs and then cider-connect-sibling-clj to run both repls. Still gives me error complaining about "ClojureScript is not available" when I just run cider-jack-in-clj&cljs. Not really sure what is the problem running cider-jack-in-clj&cljs but at least I can get both repls now.

Jee Lee15:02:23

Thank you so much for the pointers

vemv15:02:03

Happy that you got it! Feel free to suggest documentation or other improvements if you feel something could have been clearer.

Jee Lee09:02:25

Any help would be appreciated

Sam Ferrell21:02:38

Unless I'm misremembering there was a core fn to wrap a value in a vector or list unless it already was -- anyone know what I might be thinking of?

tjg21:02:54

Hmm, doesn't ring a bell. Chatgpt doesn't know it either You might find skimming the https://clojure.org/api/cheatsheet handy Something like ensure-vector doesn't sound general enough to be in core, so I suspect it isn't there

Sam Ferrell21:02:55

Maybe I'm thinking of something in Elixir 😬 thanks!

escherize04:02:11

something like: (if (coll? thing-or-things) [thing-or-things] thing-or-things) ?

vraid07:02:12

@U051GFP2V i believe he wanted it wrapped if it wasn't a vector 😉

vraid07:02:43

Also, it's not that hard to write, but the question was for a core function

Sam Ferrell22:02:10

@U0178V2SLAY uh oh that's exactly the kind of function I'm writing... maybe I'll reconsider laughcry