Fork me on GitHub
#tools-deps
<
2022-10-26
>
Noah Bogart21:10:58

I'm trying to migrate my company from leiningen to deps.edn. I've got it mostly working (step by step), and i'm currently stuck on a repl-related issue. in leiningen's project.clj, i can say :repl-options {:init-ns crossbeam.dev :init (start) :nrepl-middleware [cider.nrepl/cider-middleware]} This will pass the middleware to nrepl, start up the repl, and then enter crossbeam.dev and execute crossbeam.dev/start before passing control to me. In deps.edn, I have :aliases {:repl {:main-opts ["-e" "(require,'crossbeam.dev),(in-ns,'crossbeam.dev),(start)" "-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]" This seems to be the same (except for printing #object[clojure.lang.Namespace 0x70949361 "crossbeam.dev"] as it loads), but I'm unsure that it's doing the same thing. Is this roughly correct?

seancorfield21:10:43

If you're on Clojure 1.10 or later, that could be "-e" "((requiring-resolve '" and if you're on a recent CLI version you should be able to omit those , but otherwise, yeah, that seems right.

👍 1
Noah Bogart21:10:29

I forgot about requiring-resolve, but I'd like for the repl to start in , which is why I wrote it like that.

Noah Bogart21:10:37

Cool, thank you

seancorfield21:10:38

If I find myself writing that much code in an alias, I tend to put it in a function in .clj file and just do a requiring-resolve invocation on it.

seancorfield21:10:22

I've never understood why anyone cares what ns the REPL starts in -- it is going to track whatever REPL you're eval'ing code from your editor with anyway?

seancorfield21:10:38

(and I never type into a REPL -- I don't even have the REPL visible in my editor)

seancorfield21:10:06

At this point, I've also moved any app start stuff into REPL command snippets in VS Code/Calva, so that I can start a "bare" REPL without it starting any processes -- and then I can control what is started/stopped.

seancorfield21:10:01

(but if you want all your devs to be able to start the app the same way, it makes sense in a .clj file in the repo so everyone can invoke it that way)

seancorfield21:10:42

But we have ~20 apps so we tend to start/stop different apps depending on what part of the repo we're working in 🙂

Noah Bogart21:10:51

Sadly, we have a somewhat complicated docker set up and need a consistent entrypoint for our devs of varying clojure experience. Good point about the repl, you’ve made me realize that I can remove the in-ns stuff because we run the repl headless (in docker). Should have noticed that already.

Noah Bogart21:10:57

Thanks for the input