Fork me on GitHub
#shadow-cljs
<
2018-08-03
>
richiardiandrea00:08:58

@thheller is there a way to load a namespace that, for example, sets up custom test clojure.test/report handlers and stuff?

richiardiandrea00:08:38

I would go for preload but I remember last time we discussed about why it is not in :node-test

grounded_sage03:08:02

Hey everyone I'm finally ready to share what I have been working on. I call it Shadow JAM a JAMstack build tool built with Shadow CLJS. At the moment it's a very rough prototype. Would love it if others with more clojure experience could chime in and help me make it better. I'd love it to have a lot more polish before it lands on something like Reddit as I think it would bring a lot of interest to how much better the experience can be building Progressive Web Apps in Clojure/Script than the alternatives. https://github.com/groundedSAGE/shadow-jam

🙂 4
grounded_sage06:08:23

Would love your feedback on this @thheller

thheller06:08:38

I'll try to go over it soon. saw a few rough mistakes and you should really turn this into a proper library. people cloning all this code is absolutely not ideal and makes it extremely hard to upgrade in the future.

grounded_sage08:08:02

Yea it’s really rough, I can point to many mistakes. I either don’t know how to fix them or my domain confidence is somewhat lacking. I do plan to turn it into a library. I’ve had people telling me I should make it public so that others can help with it.

endenwer06:08:42

Hey everyone. I am trying to use shadow-cljs for electron development. I used this repo https://github.com/ahonn/shadow-electron-starter. Everything works except live reloading. Din't find how to enable it. In terminal I see compilation after changes but nothing is happening in electron app.

thheller06:08:10

@endenwer the setup in that repo is a bit broken. try changing the config to

:renderer
  {:target :browser
   :output-dir "resources/public/js"
   :asset-path "js"

   :modules {:renderer {:init-fn app.renderer.core/start!}}

   :devtools {:after-load app.renderer.core/start!}}

thheller06:08:48

and then removing the blank (start!) call from the app.renderer.core ns otherwise it'll be called twice on startup

thheller06:08:53

but that should do it

endenwer06:08:55

@thheller Thanks. It works, but I also had to update shadow-cljs version. I can submit pr with all changes if it makes sense.

eoliphant13:08:52

Well-deserved!

thheller06:08:32

my plans include making official templates/examples for all of these

endenwer06:08:14

Cider repl shows this WARNING: No Clojure project was detected. The refactor-nrepl middleware was not enabled. (You can mute this warning by customizing 'cljr-suppress-no-project-warning'.) Can I somehow fix it?

thheller07:08:42

I think you need to add https://github.com/clojure-emacs/refactor-nrepl to your deps but better ask someone actually using cider. I have no idea what its for.

bupkis08:08:00

is there a way to get Cursive to also resolve symbols from JS libraries?

bupkis08:08:15

when connected to a shadow-cljs repl

bupkis08:08:52

for example I have (ns myns.core (:require ["xregexp" as xregexp])) and can use it fine, stuff like (def my-re (xregexp "some.*regex" "g")) works fine, but Cursive shows xregexp cannot be resolved

bupkis08:08:28

it's not a big deal of course, just wondering whether I'm doing something wrong

thheller08:08:06

@samuel.wagen no that is not currently supported by cursive unfortunately

bupkis08:08:26

fair enough, just wanted to be sure I'm not missing something 🙂

nha09:08:12

congrats for the clojurists together funding!

pez12:08:32

Yes, someone just told me about the funding. Great to hear! I guess it still is a bit more symbolic than real pay, but, boy, does shadow-cljs deserve the recognition!

pez12:08:11

When using the :npm-module target what will my-constant be exported as for something like (def ^:export my-constant 5.662)?

pez13:08:15

nvm, I tested and see that it got named my_constant.

pez14:08:47

Why could it be that the cljs-repl complains about no application connected? I have started the app and I get this when I start the cljs repl:

$ npx shadow-cljs cljs-repl :calva
shadow-cljs - config: /Users/pez/Projects/clojure4vscode/shadow-cljs.edn  cli version: 2.4.26  node: v10.1.0
shadow-cljs - connected to server
[3:1]~cljs.user=> 1
No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
[3:1]~cljs.user=>
It seems to tell me that it is connected to the server, but then complains that it is not. This used to work, and I don’t think I have changed something that should make it stop working. Funny thing is that the nREPL client in Calva can connect and can do everything I tell it, except evaluating (which gives the same error message as trying to evaluate from the REPL prompt).

thheller14:08:35

@pez I'm assuming you switched to :npm-module?

pez15:08:20

Building to a local directory, not in node_modules, if that makes any difference for this problem.

richiardiandrea15:08:36

Congrats congrats, happy to see the project receiving recognition from the community!

🎉 4
koz15:08:57

Are JS includes (described in https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js) run through the Closure Compiler with advanced compilation during a release build? If so, is there a way to turn it off for those files?

pez15:08:36

@thheller was not being able to use the REPL the price to be payed for switching to :npm-module? 😃

thheller16:08:19

@pez :npm-module doesn't have a clearly defined entrypoint and as such cannot properly "preload" the devtools client. you can load it manually from JS though. so assuming you do import ... from "shadow-cljs/your.ns"; somewhere

thheller16:08:49

hmm doh. do you actually use import or require?

thheller16:08:15

well either way the point is to load shadow-cljs/shadow.cljs.devtools.client.browser before any other CLJS import

thheller16:08:52

@koz yes they run through :advanced but no you can't turn that off (currently). why would you want to?

koz16:08:35

It seems to be mangling some of my objects, for instance I’m declaring something like var kb = this.quill.keyboard; (which has an addBinding() method, which I call via kb.addBinding(). When I run it through advanced compilation, it turns kb.addBinding() into something like b.rE(), which it can’t find (I believe b still resolves to this.quill.keyboard, but it doesn’t have an rE() function on it).

koz16:08:55

I can try to draw up a simple repro case since there may be other variables at work here.

thheller16:08:13

@koz did you try shadow-cljs check your-build? you should be getting a warning for that case

koz16:08:36

Let me try that, thanks @thheller

koz16:08:52

This library continues to amaze me, great work.

thheller16:08:11

didn't check if its easily possible to do externs inference for JS

thheller16:08:47

but check should find the problem. since you already know the problem though you can just create the externs/your-build.txt with one line addBinding

koz16:08:23

Awesome, I’ll try that - completely missed that section, sounds like a useful option.

thheller16:08:51

is quill not imported via shadow-cljs? wonder why it doesn't respect the addBinding method

koz16:08:17

It’s a transitive dependency of react-quill

koz16:08:28

(which is imported via shadow)