Fork me on GitHub
David Reno11:10:03

I’m not positive if this is a CIDER or shadow-cljs question but I’ll try here: I was having trouble evaluating in a spacemacs code window until I came across a stackoverflow article describing how (for :target :node-script) I need to run node from the command line and evaluate the compiled code. (I also had to run npm install). This makes me feel like I’m missing some key documentation but I didn’t see anything about that here: Here’s the stackoverflow article that had the answer: Question: Is there more documentation that I need to read about how CIDER is launching npx shadow-cljs that will mention things like “then go to the shell and manually run node on the generated JS artifact”?

David Reno11:10:12

admittedly, I haven’t read that whole doc yet, but yes, it will help me understand the architecture. I’ll read that before asking more questions. I was hoping to find a “walk-through” type of thing that mentions all the required steps in a single place.


well the "walk-through" depends on what exactly you are building

David Reno11:10:58

I think this is a key statement in 14.3: > Regular shadow-cljs builds do not manage any JS runtime of their own so you are responsible for running them.


can't write 50 different walkthroughs for all the possible things people may be doing 😛

David Reno11:10:40

Sorry, I’m new and don’t fully understand the flexibility.

David Reno11:10:04

In my head, there’s browser app and node.js app, but I know that’s oversimplified.


hmm? thats exactly how it is?

David Reno11:10:52

only in my head… 😉


you "run" the browser by opening the page


you "run" the node.js app by running node script.js


no difference. you are still always responsible for running things


if you want to skip the manual "run" you use shadow-cljs node-repl or shadow-cljs browser-repl


that runs stuff for you


(dunno how that is intergrated with cider though)

David Reno11:10:46

that’s the part that confused me, I would have thought that CIDER would have run shadow-cljs node-repl based on :target :node-script.


node-repl is independent from builds


it can run entirely without a build config


think clj or lein repl

David Reno11:10:09

maybe when I figure this out I’ll try to write a node.js quickstart that gives all the steps. Then I’ll realize how much I’m missing.


it helps me immensely if you ask specific questions about what confuses you


I mostly have no clue which docs to write

David Reno11:10:47

sorry, let me try again…


but will happily add stuff if it helps people

David Reno11:10:27

rightly or wrongly, I think of CIDER as starting and connecting to any background processes required to evaluate code in the emacs buffer.


the stuff really isn't all that complicated in my head ... but granted that I work on this stuff for years I'm not the best to judge


can we take cider out of the equation for a second since I don't know what it does when it comes to "starting" things


let us assume for a second that you run shadow-cljs server separately


in a terminal and then connect to it via Cider remotely


(this is likely what Cider is doing when you "start" things through it)

David Reno11:10:18

warning, this is losing me because I have only a noobie understanding of how these pieces work…

David Reno11:10:56

but I will study what you write here!


hmm maybe I can guess by what cider commands you are running ...


what do you run in emacs?

David Reno11:10:18

CIDER runs this: `[nREPL] Starting server via /usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.0 -d cider/cider-nrepl:0.22.0-SNAPSHOT server... `


right .. yeah ok that starts the shadow-cljs server I mentioned

David Reno11:10:53

after I run cider-jack-in-cljs and pick “shadow” and provide the build name.


alright. that may be the problem. does it even let you continue WITHOUT selecting a build? or is generic node-repl or browser-repl an option?

David Reno11:10:41

no, pretty sure you have to pick a build.


ok, that should then be files as a bug for cider


that is not how this is intended


(I don't use emacs so I don't follow what is happening with that)

David Reno11:10:44

when cider is starting, I can pick shadow or shadow-select, I always pick shadow.


well, ok then you pick the :node-script build you created

David Reno11:10:03

then it prompts for Select shadow-cljs build (e.g. dev):

David Reno11:10:43

right, I choose app because I have

:builds {:app 


ok. then you have your CLJS repl ready


but since this is a standalone build you still need to "run" the created output

David Reno11:10:40

right. Then I have to go to the shell and run node -e "require('./target/main.js')"


yes exactly

David Reno11:10:59

as per your comment in the above mentioned stackoverflow article.


ok and your confusion comes from why you needed to run node?

David Reno11:10:06

I was expecting to do something very “nominal” and see a brief description of the steps. I suppose I was wrong in the number of things I’ve integrated with and possible steps.


ok. I'll try to think of something and add it to the docs

David Reno11:10:55

I’ll try too! Thanks for trying to get in the head of a beginner like me.


thanks for explaining

👍 4