Fork me on GitHub

@thheller hi! i’ve just started using shadow-cljs, and i love it! it’s just so fun and easy--it really shines in comparison to the clojurescript alternatives. i just wanted to let you know, and say thank you.

πŸ‘ 8
❀️ 4
😎 4

Goodday everybody, this is more of a general question in splitting up code in their own libs to be included in the main deps.edn as a dependency. In combination with the {:local/root "source-libs/io.monetashi.yesod"} option while in development.


Now is the question, when this library needs node modules, how do I ensure those are included when I build my main project in shadow-cljs?


@deplect in your lib you can include a deps.cljs with {:npm-deps {"the-dep" "version"}}


@thheller amazing, wonderful how this is structure. Find it hard to find this information online, on how to structure projects for code reuse. πŸ™ πŸ™


yeah. its a tough topic and I don't know what the best approach is myself


I certainly have my own preferred way but there are too many other ways people do it


so I don't want to force my way on everybody since the other ways are just as valid πŸ˜›


Hahaha, yes, a few years back I was working in checkouts and something called lein voom. Worked ok, until it didn't. Whenever you write an article explaining your way I would be very interested πŸ™‚


it currently involves checkouts πŸ˜‰

πŸ˜‚ 4

sometimes I just add :source-paths ["src/main" "../the-other-lib/src/main"]


I have not adopted deps.edn at all because my main projects (work and shadow-cljs) have .java sources which deps.edn doesn't deal with


I kinda like the checkouts approach to be honest since it is not committed to version control


does this also work with a shadow-cljs project, if I place my libs there using a deps.edn?


if you use deps.edn you only get what deps.edn provides


if you use lein it would work


they need to be leiningen projects, check


Hi. I'm new to shadow-cljs. I quite like what I've seen of it so far, and it seems less magic to me than what I've tried in the past, although there's still lots I don't understand. I am now trying to convert a project using lein, figwheel, cljsbuild etc. to shadow-cljs, but I'm running into an error that I have not been able to figure out. I am using historian and I get the following error from the historian code when I try to compile: > Use of undeclared Var historian.core/off-the-record where off-THE-RECORD is a macro. This works fine using lein, so I'm not sure what's wrong. I've tried a few things, but I'm not really sure where to look. Any ideas?


@esiotrot hmm the macros are setup incorrectly in historian. it works because of this which shadow-cljs sort of fixed


@thheller Thanks. So it's a bug in historian that just happens to work with lein?


yeah kind of. macros in .cljc files are tricky about about 90% of the libs I looked it do it "wrong"


relying on certain "bugs" in the compiler to make it work


(ns historian.core
  {:doc "Manage states for your atoms. (Easy undo/redo)"
   :author "Frozenlock"
   :quote "The present is the least important time we live in. --Alan Kay"}
  #?(:cljs (:require-macros [historian.core :refer (off-the-record)])))


this should be the ns form in historian


then users of that lib would not need to worry about an extra :require-macros [historian.core] themselves


I actually tried using require-macros but was not able to get it to work. Thanks for the info.


I'm debating whether or not I add support for this particular "bug". is the historian author "active"? would it be feasible to get a fix released quickly?


No idea. Looks like the latest commit was 5 months ago.


I've seen frozenlock on here in #clojurescript. Might be worth opening an issue or pinging him