Fork me on GitHub
#shadow-cljs
<
2018-03-19
>
mitchelkuijpers11:03:43

If anyone upgraded cider I made .dir-locals.el file with this code:

((nil . ((projectile-project-type . lein-test)
         (eval . (progn
                   (require 'cider)
                   (add-to-list 'cider-cljs-repl-types '("Shadow CLJS" "(do (shadow.cljs.devtools.server/start!) (shadow.cljs.devtools.api/watch :app) (shadow.cljs.devtools.api/nrepl-select :app))" nil))
                   (setq projectile-create-missing-test-files t))))))
This will make it possible to start up your cljs-repl again from emacs

thheller11:03:17

@mitchelkuijpers it still requires lein right?

mitchelkuijpers11:03:37

Yes for this solution you need leiningen

mitchelkuijpers11:03:15

Or you could connect to nrepl which shadow-cljs starts but then you have to add their middleware first

thheller11:03:18

getting rid of lein would be neat since I have more control over the setup then

thheller11:03:36

I'd love to get it working with absolutely zero-conf

mitchelkuijpers11:03:50

We want to move to a deps.edn setup at one point so that would be nice. Not sure how that works though. I am talking in the #cider room about this

mitchelkuijpers11:03:15

Btw we don't need leiningen but we need to inject the nrepl middleware

thheller11:03:55

the cider middleware is automatically added when its on the classpath

fbielejec13:03:20

hi, has anyone tried packaging shadow-cljs compiled JS (production) code into jars, for consumption in another cljs projects?

thheller15:03:14

@fbielejec for CLJS you should only be packaging the cljs source files never compiled code

thheller15:03:17

but shadow-cljs currently does not provide anything to do the packaging of those

fbielejec15:03:39

I see - and what about publishing as a module to npm registry, and then requiring via node_modules?

thheller15:03:35

:npm-module also works

thheller15:03:14

shadow-cljs started out as :node-script but :npm-module is slight more flexible but also more complex

thheller15:03:37

publish is just npm publish

fbielejec15:03:14

Gotcha - I'm looking into ways of utilizing shadow-cljs compiled modules in upstream projects still using :cljsbuild. I suppose one could force fetching of that dependency via :npm-deps or lein-npm plugin, :notify or some other mechanism?

thheller15:03:41

I cannot emphasize this enough. DO NOT USE compiled CLJS code in OTHER cljs projects

thheller15:03:36

you will get into a horrible mess if you try to do this

thheller15:03:40

nothing will work at all

thheller15:03:36

problem is that the compiled version of the library will contain its own version of cljs.core

thheller15:03:48

which will conflict with the other CLJS code being compiled in the project

thheller15:03:18

so you can't pass a cljs map from the project code to the library

thheller15:03:58

there is no viable option if the other project is using cljsbuild and doesn't understand npm-deps properly

thheller15:03:42

publishing to npm is only useful if you want your code to be consumable from JS

thheller15:03:13

for CLJS the problem is that the cljs compiler needs access to the sources. there really isn't anything that can be done about this.

fbielejec15:03:36

thanks - this will save my time from going down that rabbit hole 🙂

escherize22:03:41

@thheller I decided to just publish the p5.tiledmap to npm -- I got it working too.