cljsrn

viesti 2025-01-20T14:24:22.005329Z

Hmm, with shadow-cljs, if I have at the namespace level a :require for platform-specific library, say for Apple, like

(:require ["expo-apple-authentication" :as AppleAuthentication]
how would skip this on Android?

joshmiller 2025-01-20T22:06:27.674409Z

You can require outside of a ns form, and wrap everything in ifs

joshmiller 2025-01-20T22:06:53.315789Z

I’m surprised that library wouldn’t just be a no-op on Android though?

viesti 2025-01-21T06:43:24.674629Z

Yeah the require seems no-op, using it then not so no-op πŸ™‚ And thanks! I also learned out-of-band from Deraen that js/require outside ns form is enough πŸ™‚ Had a fear that this would be more complex πŸ˜„ I think I still don't understand enough the bundler magic in JS land πŸ˜„

πŸ‘ 1
souenzzo 2025-01-23T17:59:00.823099Z

@viesti checkout this section https://shadow-cljs.github.io/docs/UsersGuide.html#_conditional_reading you probably want to do a #?(:cljs-osx ....)

viesti 2025-01-23T18:24:44.536459Z

interesting, clause also hallucinated me a

#?(:ios [your.ios.module :as platform]
   :android [your.android.module :as platform])
so didn't believe it πŸ˜„ the stuff in shadow-cljs docs seems build :target specific, but here I would have a single target still :target :react-native , it's just that some of the javascript code inside the same target, use features that are exposes to the javascript virtual machine at specific platforms (android, ios)

souenzzo 2025-01-23T18:29:13.890729Z

can't you create two react native targets? never did it with android+ios I used to do that with browser+android

viesti 2025-01-23T18:33:30.042019Z

maybe, but not sure how to make reloading changes happen so that both android and ios device+simulator get the changes loaded, from a single rn bundler did you do react native web? Or was the web with a :browser target?

souenzzo 2025-01-23T18:34:37.133039Z

web with browser target #(:cljs-web [:div ...] :cljs-android [TextBox ...])

viesti 2025-01-23T18:41:06.006399Z

right, what I'm looking for is much like what React Native in JS would be like, single Metro bundler running and both platforms served. I don't know if it is possible to run two Metro bundlers at same time, for both targets, or to have it pick up two different bundles at same time.

viesti 2025-01-23T18:42:23.361229Z

but interesting to hear about :browser and :react-native targets from same shadow-cljs build, there actually is, at some point, a web frontend here too

joshmiller 2025-01-23T19:16:32.768919Z

@viesti You can definitely run multiple Metro bundlers.

joshmiller 2025-01-23T19:16:50.259279Z

I have a setup for a project that has both an app and a share extension

joshmiller 2025-01-23T19:18:25.449149Z

This is with Krell, so it’ll be slightly different with shadow-cljs, but once you are outputting multiple JS files from shadow (say, index.ios.js and index.android.js), you can run the Metro bundler with --entry-file index.ios.js and --bundle-output ios/bundle.js (or whatever)

souenzzo 2025-01-23T19:21:54.989149Z

@viesti our workflow was: I worked doing the web-interface, with rough :div's, but doing the events and state things Afterwards, a react native guy that didn't knew much about clojure, just added the :cljs-android part of the UI components the workflow worked and I think we were very efficient in delivering the project. all problems around state/events were debugged on the web, and simply work on react native.

souenzzo 2025-01-23T19:23:14.054029Z

(the web-interface was not part of the product)

viesti 2025-01-23T19:53:59.997719Z

Interesting, what did you use for state management?

souenzzo 2025-01-24T11:27:12.787369Z

#fulcro

viesti 2025-01-24T11:31:51.615039Z

Nice! Haven't dabbled in Fulcro myself yet πŸ˜„

souenzzo 2025-01-24T13:42:56.045519Z

Fulcro & pathom are awesome! unfortunately, I feel like they are a bit "all in" on tech

viesti 2025-01-24T13:43:46.056639Z

yeah, that has been stopping me I think, I think I haven't allocated the time to study go "all in", would like in a project, grow bit by bit