This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-03-01
Channels
- # announcements (4)
- # aws (1)
- # beginners (172)
- # cider (16)
- # cljdoc (63)
- # cljsrn (7)
- # clojure (150)
- # clojure-dev (8)
- # clojure-europe (26)
- # clojure-gamedev (6)
- # clojure-greece (23)
- # clojure-nl (4)
- # clojure-spec (10)
- # clojure-uk (101)
- # clojurescript (40)
- # community-development (5)
- # cursive (19)
- # datomic (54)
- # emacs (39)
- # figwheel-main (5)
- # fulcro (4)
- # graphql (16)
- # immutant (5)
- # jobs (8)
- # jobs-rus (1)
- # leiningen (1)
- # off-topic (31)
- # planck (1)
- # re-frame (7)
- # reagent (8)
- # reitit (6)
- # remote-jobs (4)
- # shadow-cljs (11)
- # spacemacs (18)
- # specter (2)
- # sql (58)
- # vim (2)
- # yada (5)
hi 👋 I'm requiring a namespace from an npm module loaded with shadow-cljs, what do I have to do to make it work with cljdoc?
Hi Joel! 👋 I think unless we switch the underlying analyzer to shadow's implementation there's nothing easy we can do here
If this is a library I would recommend to use plain CLJS because otherwise all consumers will be required to use shadow-cljs as well (might be ok but certainly a smaller user-pool)
it's not a library, the cljs files can be used by child projects but it's not their main usecase. in this case the cljs is the backoffice of an ecommerce site, and this dependency is only going to be used to build sites /extend the software
but, can the cljs be ignored? so that my clj sources are analyzed and the documentation is picked up
don't care that much about the cljs part, it's not documented anyway
also can it stop using the dev profile?
@U5LPUJ7AP there's no concept of profiles in cljdoc's analyzer. We look at a projects pom file (http://repo.clojars.org/ventas-core/ventas-core/0.0.13/ventas-core-0.0.13.pom) and try to include some additional dependencies that a project might need.
Eg. some namespace might need core.async but it's expected that the user provides it. Often these kinds of dependencies can be found in the pom with <scope>test</scope>
etc
ah sorry. so can the cljs files be ignored?
selecting platforms isn't supported for users at this stage but I can hardcode it for you if you want
well, sure 🙂
(have done so for other projects, would be no problem)
"ventas-core/ventas-core"
is correct?
no, just ventas-core
I should have called it joelsanchez/ventas-core
but I haven't. so...
ok (that's the same)
Maven has group and artifact IDs. In Clojure when you have a project ID that doesn't contain a /
it implies that they're both the same
learning every day... 😛
didn't know this for a long time either (and it's not really all that useful to know hahaha)
@martinklepsch this should work fine if you respect deps.cljs
and install the dependencies listed there
yeah, I guess that's the issue then
the problem is that CLJS needs to index the node_modules directory to understand that "react-color"
is a npm dependency.
I'm not sure if there is a setting to just make it ignore any string deps? I think :target :nodejs
does something to that extent? I'm not actually sure how any of this works in default CLJS anymore
since you only analyze and not actually compile it would be fine to just ignore the string deps and treat them as a plain JS object
I should have some time tomorrow, maybe I can figure something out that cljdoc parses these properly
that would be super nice 🙂 otherwise I might get to it eventually 🙂
thank you both @U05224H0W @martinklepsch for your help and for your outstanding projects
@martinklepsch can you point me to the code that does the analysis? the function that starts it all?
That namespace has a -main
. What you'll need to do to play with that is:
1. Unpack the contents of the dependency's jar into a directory
2. Add it as a dependency to the local deps.edn
then you should be able to run something like clj -m codox.main clojurescript jar-contents-dir
It's a little fiddly, let me try to push a commit with some inline docs/pointers for this
https://github.com/cljdoc/codox/commit/b29b16ae686e3400689bbdc93df57200b709443d
(a bit off topic, but related: is shadow-cljs basically a different dialect of CLJS? what if you write a lib in that, can normal CLJS not consume it? feel free to respond on a thread)
Yeah, I think that's pretty much correct /cc @U05224H0W
no that is incorrect. shadow-cljs is a build tool for clojurescript. the language stays the same with one little exception: https://dev.clojure.org/jira/browse/CLJS-2376 this is already implemented
nope that is completely standard. I'm guessing that the npm dependencies just aren't installed?
Sorry for the confusion here @U05224H0W and thanks for chiming in
node_modules is gitignored so they won't be installed by default
there is a package.json with react-color and the other deps though
sorry, git is irrelevant, but node_modules is not inside resources
and not in the artifact at all
Thomas gave some more context on that in the other thread
finally finished writing that blog post I've been thinking about for a while ... maybe it clears up some of the confusion: https://code.thheller.com/blog/shadow-cljs/2019/03/01/what-shadow-cljs-is-and-isnt.html
One thing I didn’t get is that you’re referring above to CLJS-2376 which introduces this string syntax in require, and that shadow-cljs already implements this. But CLJS-2376 is not yet in CLJS master it seems, so the language is in that aspect still different?
CLJS-2376
introduces :default
not the string requires. string requires have been implemented for a while
https://github.com/clojure/clojurescript/commit/dd5d86223f359e06434a152ad0ea5e0bee317459
@martinklepsch I made some adjustments to the codox stuff so that string requires work without actually having to install npm dependencies. https://gist.github.com/thheller/5bc57a7571cf83fd12190ab7165cdb46
the main difference is that the compiler state is only created once in read-namespaces
instead of re-creating it all the time