Fork me on GitHub
#cljsrn
<
2016-10-13
>
herbm07:10:52

Is there a good guide to using npm included libraries (e.g., npm i LIBNAME --save) -- the part where we fix up add dependencies. Do we first just follow the npm library doc to add to setting and build gradle files? What do we do for project.clj or our cljs files etc? Is there a guide for this part?

herbm07:10:44

And I need this for android primarily...

pesterhazy07:10:43

@doglooksgood, I'd be happy to merge a PR!

pesterhazy07:10:41

@doglooksgood how do you make a release? Is there something about SimpleExampleApp that would need to be changed?

tianshu07:10:01

I hope i can send a PR, but i have no experience. i've asked this question before and @vikeri gives me the answer.

tianshu07:10:41

I just forgot to write down on my note, so I missed it šŸ˜¢

Niclas08:10:26

What tools are you using for profiling the performance of your react native apps?

vikeri08:10:50

@doglooksgood We have a couple of issues that we are working on. Will probably submit a PR to brn when we have figured it out. These issues do not prevent us from releasing but it is flawed: 1. document is not being found if we just do a normal :advanced compilation without the rn/after-cljsbuild task. 2. for the rn/after-cljsbuild task to work one needs to add the reload task before cljs build, even in production. Solution: Decouple the reload part from rn/after-cljsbuild. We use fastlane for the actual building of the Android app and it works great. Are there a certain step that you are curious about?

tianshu09:10:21

i'm not sure, but what is the problem if we simply compile cljs with :advanced without introduce any boot task?

vikeri09:10:05

The variable document is not found (since it is React Native). There is a brn task that shims this.

tianshu09:10:35

Oh, got it. It's very strange that re-natal just use lein cljsbuild once min, generate one file(index.android.js).

tianshu09:10:13

IMO, the boot-cljs should do the same work as lein-cljsbuild?

pesterhazy09:10:11

@vikeri not sure that after-cljsbuild should even be needed

pesterhazy09:10:35

have you looked at the bundle task?

pesterhazy09:10:58

this is all I use for iOS:

(deftask dist
  "Build a distributable bundle of the app"
  []
  (comp
   (cljs :compiler-options (merge default-compiler-options {:optimizations :simple
                                                            :closure-defines {'goog.DEBUG false}
                                                            :elide-asserts true
                                                            :preamble ["preamble.js"]}))
   (bundle :files {"main.js" "main.jsbundle"})
   (target :dir ["app/dist"])))

pesterhazy09:10:34

(note we don't use advanced optimization for prod builds, it doesn't seem worth the trouble right now)

vikeri09:10:24

@pesterhazy Nope I have not, donā€™t know how to include a main.jsbundle for Android though, they fire up a gradle script doing the npm bundle automatically.

pesterhazy09:10:04

sounds like you need to dig into gradle :shudder:

vikeri09:10:41

Haha I have done it partly but digging deeper will not be awesome.

vikeri09:10:01

Sidenote: If you can get a proper main.jsbundle, why to we need the react native packager? Couldnā€™t that bundle just be served to localhost:8081?

pesterhazy09:10:58

the problem is that it takes minutes to build this bundle

pesterhazy09:10:16

not acceptable for interactive use

pawel.kapala16:10:17

Hey! Were you able to use day8.re-frame.http-fx with re-natal? Iā€™m struggling to find issue in my handler:

(reg-event-fx      ;; <-- note the `-fx` extension
 :request-it       ;; <-- the event id
 (fn                ;; <-- the handler function
   [{db :db} _]    ;; <-- 1st argument is coeffect, from which we extract db 

   ;; we return a map of (side) effects
   {
    :http-xhrio {:method          :get
                 :uri             "https://jsonplaceholder.typicode.com/posts/1"
                 :on-success      [:process-response]
                 :on-failure      [:bad-response]}
    :db  (assoc db :loading? true)}))
I get a cryptic exception that says ā€œInvalid -> new -> ā€¦ -> day8$re-frame$http_fx$http_effect ...ā€. BTW: this is an example available here: https://github.com/Day8/re-frame/blob/master/docs/Talking-To-Servers.md#version-2

pawel.kapala16:10:03

Just for reference, I missed: :response-format (ajax/json-response-format {:keywords? true}) and that seems to fix the problem, for details see here: https://github.com/Day8/re-frame-http-fx#step-2-registration-and-use

herbm19:10:54

Apparently adding into ../images is insuffienct if you js/require it, even after restarting my package manager. Is there some other trick to get new resources picked up and added to the package?

misha19:10:33

.. relative to what?