hi, I’m starting to develop a deps-new template and it seems like my template.edn could be more concise; this is all new to me though so I’d appreciate some feedback. The edn is
The best thing you can do here IMO is to get rid of the clj/cljs separation. Just keep move it all a level up, directly to src. Such a separation bears no meaningful purpose but makes navigation worse, especially when you have shared code which you then have to put in cljc.
I’m using cider, so maybe this is a cider-centric question. In projects which have both clj and cljs content, I start two repls, one for “normal” clj and one for shadow-cljs. In cider, in sesman-browser I can then associate a specific directory (or file, or buffer, or project…) with an nrepl session, so that when I’m in a source file and I’m evaluating expressions, the expressions go to the correct repl.
If all the source files are in the same directory structure and mixed up, how do you achieve this seperation, @p-himik ?
when I’m in a source file and I’m evaluating expressions, the expressions go to the correct repl.
Can’t this be decided based on the file extension? In general, you can’t evaluate code from .clj in a CLJS REPL, same for .cljs and a CLJ REPL. With .cljc it gets more complicated - you’d have to explicitly select the right REPL for each evaluation, I suppose. But that would be true even with directory separation.
I’m not a frequent user of CLJS REPLs, so can’t really answer. But I imagine, I’d prefer a workflow where all forms that I evaluate get sent to the most recently used REPL, the “active” one.
From what I understand CIDER should send clj forms to the clj repl automatically. It might get complicated if you have multiple clj repls in a project for some reason.
@p-himik I like the idea of a flatter directory but I’ve never seen anyone structure a project like that, are there any other considerations/gotchas if you do?
I’ve never seen anyone structure a project like that
My experience is almost the opposite - I see both kinds of structure, but the flat one seemingly gets more and more prevalent. But that’s just my perception, I don’t have any actual data.
are there any other considerations/gotchas if you do?
I have a similar setup but substitute shadow-cljs for figwheel, and on top of what you’ve written, there is also the issue of watching directories and hotloading files. I have separate src (for all .clj) and cljs-src (for .cljs and .cljc) files. If I put everything under just src then every time I save the any file, even .clj, it will trigger a compilation of all files.
From a management point of view, I also believe it’s much cleaner to keep the two separated.