Fork me on GitHub
#shadow-cljs
<
2021-01-10
>
thheller00:01:13

@ajsnow2012 should be fixed in latest version

AJ Snow02:01:34

ok, thank you sir!

thheller00:01:42

@ghvanw283 the closure compiler does not support dynamic import() so shadow-cljs doesn't either

thheller00:01:04

@royalaid there is no CLJ funtion to connect to a remote server. that is all done from the npm bits. I guess you could do the same thing that does but there is nothing built-in for that from CLJ

👍 3
GHvW01:01:47

Got it. Thank you so much for the reply @thheller

stuartrexking02:01:53

I’m getting a compile error I don’t understand. 1. In a CLJC file, in a #?@(:clj block I require a couple of clj namespaces, using :as to name them. 2. In that same CLJC file, in a #?(:clj form, I use those names to destructure keys on a map param. I get this:

stuartrexking02:01:31

Does shadow parse :clj forms?

stuartrexking02:01:07

Yeah that was it. CLJC for everything or nothing.

zendevil.eth06:01:02

how to run tests in shadow-cljs?

zendevil.eth06:01:11

I have the following shadow-cljs.edn

zendevil.eth06:01:29

that contains a test build

zendevil.eth06:01:29

{:deps true
 :source-paths ["src"]

 :dependencies [[reagent "0.10.0"]
                [re-frame "0.12.0"]
                [re-frame-steroid "0.1.1"]
                [rn-shadow-steroid "0.2.1"]
                [re-frisk-remote "1.3.3"]
                [cljs-ajax/cljs-ajax "0.8.1"]
                [day8.re-frame/http-fx "0.2.2"]]

 :builds
 {:test {:target :browser-test
         :test-dir "test/humboi"
         :runner-ns humboi.core
         :devtools  {:http-port          8021
                     :http-root          "test/humboi"}
         }
  :dev
  {:target     :react-native
   :init-fn    humboi.core/init
   :output-dir "app"
   :compiler-options {:closure-defines
                      {"re_frame.trace.trace_enabled_QMARK_" true}}
   :devtools   {:after-load steroid.rn.core/reload
                :build-notify steroid.rn.core/build-notify
                :preloads [re-frisk-remote.preload]}}}}

zendevil.eth06:01:59

but running (shadow/watch :test) doesn’t run the tests

zendevil.eth06:01:15

my tests are in the test/humboi directory

zendevil.eth06:01:23

and the core.cljs contains

zendevil.eth06:01:33

(cljs.test/run-tests)

zendevil.eth07:01:43

I’m getting the following error:

zendevil.eth07:01:43

Errors encountered while trying to parse file /Users/prikshetsharma/Desktop/Humboi/node_modules/react-native/index.js {:line 13, :column 7, :message “cannot use keyword ‘typeof’ here.“}

dmrd07:01:22

I am in search of examples using shadow cljs with replumb. Is anyone familiar with any example code? Came across this thread in this channel previously, which describes that bootstrap shadow target is probably necessary. For context, I’m debugging a replumb repl I have setup that doesn’t seem to have any symbols defined in the cljs/user namespace. Basic types like 1 and 'this-is-a-keyword work fine, but defs & any function call fails

dmrd07:01:20

I have a feeling it is related to the default init-fn! for replumb not working out-of-the-box with shadow: https://github.com/arichiardi/replumb/blob/dde2228f2e364c3bafdf6585bb1bc1c27a3e336c/src/cljs/replumb/browser.cljs#L4

zendevil.eth07:01:59

this is my core_test.cljs

zendevil.eth07:01:02

(ns humboi.core-test
  (:require [humboi.core :as sut]
            ["@testing-library/react-native" :refer [render fireEvent]]
            [humboi.auth.core :refer [google-sign-in-comp]]
            [cljs.test :as t :include-macros true]))

(defn mount! [component]
  (render (r/as-element component)
          #js {:container (testing-container)}))

(deftest google-login-test
  (is (mount! [google-sign-in-comp])))

(defn start [] (cljs.test/run-tests))

(defn stop [done]
  ;; stopping the tests 
  (done))

(defn ^:export init []
  (start))

thheller11:01:53

@ps ask in #cljsrn. I do not know anything about react-native testing but I do know that you cannot run them via :browser-test or :node-test

ribelo17:01:39

I will try to explain a rather complicated problem in my "English" ;) I am trying to use macro with alter-var-root to redefine how defn and defn-.

(ns patch.tufte
  (:require
   [taoensso.tufte :as tufte :refer [p]]
   [taoensso.encore :as enc]
   #?(:clj
      [cljs.core]))
  #?(:cljs (:require-macros [patch.tufte])) <- Here's the problem!
  )

...
...

#?(:clj
   (alter-var-root #'cljs.core/defn (constantly #'defnp)))

#?(:clj
   (alter-var-root #'cljs.core/defn- (constantly #'defnp-)))
If the specified line is not commented out when launching shadow, it looks like cljs.core is compiling with my new defn. However, if I uncomment the line after compiling the project for the first time, everything works. Can it be solved somehow?

thheller18:01:49

side-effects like that are not supported and will break just about everything shadow-cljs knows about compiling

ribelo18:01:37

Still, shadow-cljs it's awesome 🙂

ribelo18:01:07

Thanks as always for your work and quick reply.

ribelo19:01:38

@thheller is there any way to force recompilation of the ENTIRE project?

ribelo19:01:38

after compile time after using force-compile in the dashboard it seems to me that this only compiles the latest changes

thheller20:01:27

@huxley you can delete the cache in .shadow-cljs/builds/<build-id>

thheller20:01:46

otherwise it'll always use the cache

thheller20:01:09

need to restart the watch after that though since that still everything in memory