Fork me on GitHub
#shadow-cljs
<
2019-04-27
>
wiseman00:04:42

@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.

deplect10:04:18

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.

deplect10:04:14

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?

thheller10:04:13

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

deplect10:04:47

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

thheller10:04:36

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

thheller10:04:00

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

thheller10:04:17

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

deplect10:04:32

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 πŸ™‚

thheller10:04:37

it currently involves checkouts πŸ˜‰

thheller10:04:07

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

thheller10:04:21

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

thheller10:04:23

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

deplect10:04:25

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

thheller10:04:43

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

thheller10:04:48

if you use lein it would work

deplect10:04:56

they need to be leiningen projects, check

esiotrot19:04:01

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? https://github.com/wodin/shadow-historian-test

thheller20:04:31

@esiotrot hmm the macros are setup incorrectly in historian. it works because of this https://dev.clojure.org/jira/browse/CLJS-2454 which shadow-cljs sort of fixed

esiotrot20:04:14

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

thheller20:04:19

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

thheller20:04:13

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

thheller20:04:40

(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)])))

thheller20:04:52

this should be the ns form in historian

thheller20:04:22

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

esiotrot20:04:31

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

thheller20:04:19

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?

esiotrot20:04:54

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

lilactown20:04:55

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