Fork me on GitHub
#shadow-cljs
<
2022-03-03
>
steveb8n06:03:31

Q: is there a way to use shadow deps (not deps.edn deps) but using a git repo instead of a maven/clojars dep?

steveb8n06:03:56

i.e.

{:git/url    ""
                                 :sha        "36894d9fd348576e265a6c129664fba159c4b319"
                                 :exclusions [thheller/shadow-cljs]}
but in the shadow-cljs.edn

steveb8n06:03:48

might seem a bit odd but I have a situation where I have code that I need to load in a local repl but ignored by shadow. I have a second source path called “generated” and that’s the only place I want shadow to find source files

steveb8n06:03:17

normally I would do this by letting shadow control the source paths i.e. :deps false

steveb8n06:03:46

but I am using the git dep above so I need deps.edn to load it. so now I’m stuck between 2 goals

steveb8n06:03:37

I can’t figure out a good directory layout to get around this

steveb8n06:03:23

another option would be to load using deps.edn but then use the shadow api to remove the “src” path before it is started

thheller06:03:56

shadow-cljs.edn does not support git deps

thheller06:03:05

but doesn't sound like you actually need that?

thheller06:03:17

I mean just create a local checkout with whatever version you want

thheller06:03:36

and add :source-paths ["src/main" "../that-checkout/src/generated"] or so?

thheller06:03:58

you can still add the regular dependency as well but it will pick source files from the source path over the files in the jar

thheller06:03:44

that lib doesn't have a generated dir though? not sure I get what you are after 😛

steveb8n06:03:06

yeah I was just looking a docs and the use case is similar to https://shadow-cljs.github.io/docs/UsersGuide.html#_javascript_dialects

thheller06:03:51

but that lib is cljs?

steveb8n06:03:09

that’s an interesting idea. just checkout the git lib locally and then use shadow for deps, pointing at that dir

steveb8n06:03:36

it’s https://github.com/ribelo/doxa but I’m using a non-master branch

steveb8n06:03:17

ok. I’ll try a local checkout. that would be a simple/easy fix until doxa gets a clojars release

steveb8n06:03:29

thanks! I’ll report back here

steveb8n00:03:02

@U05224H0W I found a better solution. as long as none of the source files in “src” are required, they are ignored by shadow compile. in this way I can use deps :true and include both source paths without cljs complaining

thheller05:03:32

well, yes shadow only ever compiles files that are actually :require'd somewhere

mkvlr14:03:01

if an expected change has an effect on one machine but not on another, what are places we can clear fix it? We’ve cleared .shadow-cljs & node_modules/ anything else? (Also tried other places like ~/.cljs which I’m pretty sure shadow doesn’t use)

mkvlr15:03:35

looks like a clojure upgrade fixed it

Derek20:03:25

Looks like the npm package for shadow-cljs is a patch version behind (2.17.6 in Clojars, 2.17.5 on npm)