Fork me on GitHub
#shadow-cljs
<
2019-04-26
>
polymeris03:04:09

is it possible to set the nREPL port by build so I can have both tests and the browser target running at the same time?

thheller06:04:14

@polymeris why would that require different ports? you can just open multiple connections?

polymeris14:04:06

Oh, just to avoid shadow-cljs complaining about the port already being bound

thheller14:04:21

what do you mean?

thheller14:04:50

that only matters if the port conflicts with other projects? one project only needs one nrepl port and can serve many builds under that port?

polymeris14:04:35

Hmm, maybe I am doing it wrong. But I am running shadow-cljs watch browser and shadow-cljs watch test in parallel, and since they both try to use the same port for nREPL, one of them will complain

thheller14:04:05

ok first of all it is fine to just run shadow-cljs watch browser test in one process

thheller14:04:23

if you start shadow-cljs watch browser and shadow-cljs watch test at the same time manually

thheller14:04:35

they both don't detect each other and start a "fresh" JVM instance each

thheller14:04:49

shadow-cljs has a built-in server-mode which you are then not using

thheller14:04:25

so you could also just run shadow-cljs server to let the server start

thheller14:04:49

and then run 2 separate watch instance that will just use the running server instead of starting their own JVM instances

thheller14:04:21

but the easiest thing is probably just shadow-cljs watch browser test

polymeris14:04:32

That makes a lot of sense

thheller06:04:56

all builds can be running at the same time and you can either switch between the REPLs

thheller06:04:03

or open one connection per build

Bravi12:04:31

hello people. I'm trying to use react-pose (https://popmotion.io/pose/learn/popmotion-get-started/) with reagent through shadow-cljs 🙂 This might actually be a reagent question, but I thought I would start here Basically, the example says to do

const Box = posed.div();
and this is what I do in cljs
(:require ["react-pose" :default posed])


(def box (.div posed))
but then I cannot render this and I have tried the following ways:
[:> box]
[box]
(reagent/as-element [:> box]

thheller12:04:15

and what doesn't work?

thheller12:04:33

[:> box] should be what you need

Bravi12:04:08

env.cljs:191 error when calling lifecycle function one.core/start TypeError: Cannot convert a Symbol value to a string

Bravi12:04:12

this is what I get if I do that

thheller12:04:19

@bravilogy that looks like you are maybe trying to print the result of that call?

thheller12:04:49

that in general doesn't work for react elements

Bravi12:04:01

I'm trying to render it like you posted above 😞

thheller12:04:45

what do you do in one.core/start?

thheller12:04:56

is there a prn in there?

Bravi12:04:08

(defn start []
  (reagent/render-component [hello-world]
                            (. js/document (getElementById "app"))))

Bravi12:04:27

(defn hello-world []
  [:> box])

thheller12:04:26

maybe this isn't allowed and it needs an actual arg? (def box (.div posed))

thheller12:04:34

(def box (.div posed #js {}))

Bravi12:04:48

ok I'll play around with it some more

Bravi12:04:50

thank you

Bravi12:04:23

I can't find a nice react animation library that would worked great with reagent 😄

Bravi12:04:57

I tried react-spring as well, but since their new version is using hooks, it makes it difficult

thheller12:04:06

hmm yeah dunno what the plan for that is in reagent

richiardiandrea17:04:42

is anybody using shadow for AWS lambdas? Can I peek at your shadow-cljs.edn 😄 ?

clojuregeek17:04:34

i'm following the example from the docs for shadow-cljs compile npm . .. no errors but when i try to use the package in node

> var x = require("shadow-cljs/demo.foo");
{ Error: Cannot find module 'shadow-cljs/demo.foo'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)

clojuregeek19:04:39

nevermind i figured it out, but i think i'll submit a PR to explain it for the next guy

thheller19:04:47

@clojuregeek what was the issue? the :npm-module docs are a bit light and could definitely be improved

clojuregeek19:04:18

@thheller the default shadow-cljs.edn has src/main whereas I has my files in src/demo/foo.cljs

clojuregeek19:04:56

so i think it just needs to update if you are using the new shadowcljs.edn to set the src

clojuregeek19:04:08

thanks 🙂

martinklepsch22:04:57

@richiardiandrea using it with google cloud functions, happy to share if that would help

richiardiandrea22:04:41

@martinklepsch thanks a lot! I think I have a good setup now:

{:source-paths ["lambda-src"]
 :builds {:aws {:target :node-library
                :exports {:handler ingest-events.aws/handler}
                :output-to "ingest-events/index.js"
                :js-options {:js-provider :shadow
                             :keep-native-requires true}
                :release {:compiler-options {:source-map true
                                             :optimizations :simple}}}}}

richiardiandrea22:04:59

this way I am producing a self-container index.js exposing the handler only

martinklepsch22:04:11

yeah, that's similar to what we're doing

martinklepsch22:04:25

we use exports-var but not much of a difference

richiardiandrea22:04:19

cool awesome thank you again 😄