Fork me on GitHub
#shadow-cljs
<
2019-08-11
>
mccraigmccraig14:08:00

is per-build-target :source-paths / :dependencies config possible in shadow, or do i need to include all test stuff in the top level ?

p-himik14:08:18

I don't think it's possible with just shadow-cljs.edn but it's definitely possible with shadow-cljs.edn + deps.edn.

mccraigmccraig14:08:10

ha, that'll be something for the future then... i've had enough fiddling about with build-systems time (moving from boot-cljs -> shadow-cljs) to last me for a little while

p-himik14:08:05

Oh, but you won't need anything but Shadow-CLJS, even if you use deps.edn. It's just an additional flag in shadow-cljs.edn: https://shadow-cljs.github.io/docs/UsersGuide.html#deps-edn

mccraigmccraig14:08:53

it's the clj builds in the rest of the multi-module project still using lein which are stopping me... they will all need converting to deps.edn ...

p-himik15:08:22

Well, Shadow-CLJS also supports Lein - just scroll a bit above. It doesn't describe a way to directly call shadow-cljs while specifying profiles but I bet you could do it if you launch it via lein itself.

mccraigmccraig15:08:54

i definitely don't want more lein in the build 😬... all the clj build will be moving to deps.edn at some point soon, and i'm using gulp to run shadow atm, which is working very nicely

thheller15:08:57

source-path and dependencies are global yes. usually it doesn't matter whats on the classpath though since the build decides what goes into it not the classpath

cjsauer15:08:19

Running into TypeError: shadow.js.shim.module$react_native.Text is not a function while trying to use :react-native target. ns looks like this:

(ns my-app.mobile
  (:require ["expo" :as ex]
            ["react-native" :as rn]
            [rum.core :as rum]
            [shadow.expo :as expo]
            ))

(rum/defc root
  []
  (rn/Text #js {} "TEST"))

(defn ^:dev/after-load mount
  []
  (expo/render-root (root)))

(defn start!
  []
  (mount))
Seems like "react-native" is defaulting to some kind of shadow shim, but I’m likely doing something wrong…

cjsauer15:08:18

Oh…I have to “adapt” the react element:

(rum/defc root
  []
  (r/createElement rn/Text #js {} "TEST"))

cjsauer15:08:38

Where r is required like ["react" :as r]

cjsauer15:08:51

Works now :thumbsup:

cjsauer15:08:24

Loving this source map support in react native. Amazing work.

thheller15:08:38

you were calling (rn/Text #js {} "TEST") but Text is a react element not a function

thheller15:08:05

dunno how it works in rum but in reagent you'd use [:> rn/Text "Test"]

cjsauer16:08:56

Indeed. Came up with this for now:

(defn >$
  [class props & children]
  (apply r/createElement class (clj->js props) children))

(def view (partial >$ rn/View))
(def text (partial >$ rn/Text))

cjsauer16:08:01

Seems to work fine using rum

cjsauer16:08:31

I’m guessing the :> helper in reagent is doing something similar

neupsh17:08:16

is there a way to expose the shadow-cljs required module through the current namespace?

thheller17:08:49

not sure what that means?

neupsh17:08:35

for example, if I have

(ns my.ns
  (:require ["@firebase/app" :refer [firebase]]))

(def firebase firebase)

neupsh17:08:03

it would be nice to expose the backing "firebase" for when i need it in repl?

thheller17:08:22

yeah like that. just don't use the same name

thheller17:08:29

(def firebase firebase)

thheller17:08:34

that is a self reference and invalid

thheller17:08:06

(ns my.ns
  (:require ["@firebase/app" :as x]))

(def firebase x/firebase)

👍 4
Trevor23:08:00

Hi folks, would shadow cljs be the appropriate tool to help with a Phaser 3 game written in clojurescript? (expect a bunch of js interop)