Fork me on GitHub
#shadow-cljs
<
2021-12-01
>
Drew Verlee03:12:13

@quoll ^ discuss here? if its a toy project can you share it on github? I'm sure someone can figure out whats not working correclty. If you added shadow to an existing project, then you likely need to change how your handling deps and building etc...

quoll03:12:05

sure. Let me put it up there

quoll03:12:29

I mean… it’s basically nothing

Drew Verlee03:12:49

I'm guessing we need to add a build.

quoll03:12:50

I’ll note that I can run shadow-cljs node-repl on the command line, and from there I can load toy.m2 and execute the function in there

quoll03:12:20

maybe the paths aren’t set up? When I’m at the repl in cider, I tried this:

shadow.user> (require '[toy.m2])
Execution error (FileNotFoundException) at shadow.user/eval27877 (REPL:45).
Could not locate toy/m2__init.class, toy/m2.clj or toy/m2.cljc on classpath.

quoll03:12:52

meanwhile, at the command line:

cljs.user=> (require '[toy.m2])
nil
cljs.user=> (ns toy.m2)
nil
toy.m2=> f
#object[toy$m2$f]
toy.m2=> (f 2 3)
5

Drew Verlee03:12:05

my cider-jack-in-cljs seems to just hang. Which is a matter of some confusion for me.

Drew Verlee03:12:20

going to restart emacs...

Drew Verlee03:12:16

oh. i didn't install shadow globally

Drew Verlee03:12:47

ok. @quoll i can eval expressions in emacs for your toy project if i 1. npm install (which is what i was stalled on lol) 2. cider-jack-in-cljs (shadow > browser | node )

quoll03:12:20

I hadn’t run npm install now that I have, it’s asking me for a build :woman-shrugging:

Drew Verlee03:12:56

isn't there a "browser-repl" or a "node" option?

Drew Verlee03:12:24

In the larger sense, what type of application/build are you planing on building?

quoll03:12:52

a clojurescript library

quoll03:12:00

no UI at all

Drew Verlee03:12:16

I believe it makes the most sense for the target to be "browser" then even though you don't plan on actually rendering something a browser, thats the like... plateform.

quoll03:12:00

eh… when running this stuff I’m almost exclusively in node, though I know others will use browsers

Drew Verlee03:12:49

You can develop it using the node repl. As long as you don't call any node specific functionality it would be fine.

Drew Verlee03:12:29

Or i suppose you can, but then you could use macros to tell which env your in and choose the correct code.

quoll03:12:23

It’s really frustrating…. I am running shadow-cljs at the command line, and the repl there loads the namespace fine. I then try cider-connect to that same process, and it can’t find the namespace. It’s like the nREPL server is completely independent of the process that’s giving me the CLI repl

Drew Verlee03:12:04

are you running cider-connect-cljs ?

quoll03:12:27

I wasn’t aware that connect had that option. OK, I’m back to where I was a moment ago… it’s asking me for a build, and so far I have been unsuccessful at guessing what a “build” is

Drew Verlee03:12:17

when i use cider-jack-in-cljs it gives me a couple default "shadow builds" of node and repl. If you start from the command line i'm not sure they are there. looking at shadow docs

Drew Verlee03:12:03

running shadow-cljs browser-repl Then cider-connect-cljs -> browser-repl , would likely work except now i need to inject my nrepl deps.

Drew Verlee03:12:19

which is why i always use cider-jack-in-cljs because it injects them for me

quoll03:12:38

huh… choosing a build of “node” didn’t give me an error of “build not found”. Instead I have a failed assertion

Drew Verlee03:12:05

Here is a node repl

➜  toy git:(main) ✗ shadow-cljs node-repl
shadow-cljs - config: /home/drewverlee/Personal/toy/shadow-cljs.edn
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.16.6 running at 
shadow-cljs - nREPL server started on port 35837

quoll03:12:46

OK. I get something similar

Drew Verlee03:12:21

then i would do cider-connect-cljs > shadow > node-repl

Drew Verlee03:12:02

then if i check my repl buffer in emacs illl get

;; Connected to nREPL server - 
;; CIDER 1.2.0snapshot (package: 20211123.1732), nREPL 0.8.3
;; Clojure 1.10.3, Java 11.0.11
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;;
;; ClojureScript REPL type: shadow
;; ClojureScript REPL init form: (do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/node-repl))
;;
WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it! (More information)
To quit, type: :cljs/quit
[:selected :node-repl]WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 3.2.2 (package: 20211117.1008) and n/a, respectively.
You can mute this warning by changing cljr-suppress-middleware-warnings.shadow.user> 
cljs.user> 

quoll03:12:15

node-repl is something I haven’t tried. Let’s try that

Drew Verlee03:12:58

Yea, i think it's a bit confusing bc there is just a "node" option that's not nested under shadow. I'm guessing that works to ... somehow 😖... in a none shadow context.

quoll04:12:15

It’s working! I can’t do things like C-c M-n M-n, but I can type at the repl in emacs!

Drew Verlee04:12:07

great. So likely you get the same warning i do in my repl buffer telling you that "cider requires cider-nrepl"?

quoll04:12:46

Yes. I’ve had this warning ever since I first started using Cider (with Clojure) a few years ago. I can’t make it go away. But it has never interfered with Cider on Clojure, so I eventually stopped trying to fix it

quoll04:12:39

Drat. C-c C-k doesn’t work. 😞

Drew Verlee04:12:03

I use space emacs, i'm not sure what that command does.

quoll04:12:15

load the namespace

Drew Verlee04:12:35

There are a couple ways to have the cider-nrepl dep be added so everything works. docs here https://shadow-cljs.github.io/docs/UsersGuide.html#user-config and here: https://docs.cider.mx/cider/cljs/shadow-cljs.html If your going to use "cider-connect-*" (as opposed to "cider-jack-in-cljs") then this note here is relevent https://docs.cider.mx/cider/cljs/shadow-cljs.html#using-cider-connect-cljs > > If cider-nrepl isn’t in your classpath you should make sure it’s there. You can do this by adding it to :dependencies in the shadow-cljs.edn configuration file residing in the root of your project. Alternatively you can set cider-repl-auto-detect-type to nil, as the auto-detection of REPL types doesn’t work without cider-nrepl.

Drew Verlee04:12:58

err. that note is correct, but that would mean you pakage up nrepl-cider with your package when you distribute it.

Drew Verlee04:12:15

i would put it in the project root /.shadow-cljs/config.edn or ~/.shadow/config.edn which are merged in but not added in prod builds.

Drew Verlee04:12:45

@quoll ^ some more notes. I'll likely need to crash in a minute .You should definitely get cider working properly! I can help tomorrow if you have issues. Your talks on graph databases and rules engines are a joy to watch. I keep wanting to flirt with Asami to!

quoll04:12:01

Thank you for the compliment 🙂

quoll04:12:49

Turns out that when I moved things into “toy” I left one terminal in the wrong directory (with identical contents). This has been causing me grief 😬 Sorry!!!!

quoll04:12:20

It’s working! Whew! You may not see this until morning, but thank you for your patience!

thheller06:12:21

if this is not current anymore I'd appreciate an update https://shadow-cljs.github.io/docs/UsersGuide.html#cider

thheller06:12:32

I don't use emacs so I have no clue how any of it works

Ryan21:12:19

I updated IntelliJ today to latest (2021.2) and now built apps are showing that a previously available node module is unavailable, among some other curious errors (like fn not existing).. any clues or reported troubles with IntelliJ 2021.2?

Ryan21:12:05

I restarted intelliJ to no avail, but a full computer restart prompted shadow-cljs to download a new version, rebuild and all is well! 🙂