cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
Dominic Pearson 2021-05-03T19:58:39.108700Z

Hi folks. I've spent several days experimenting trying to get my cljsrn setup working, having tried krell, expo, react-native-figwheel-bridge, and custom hand-made configurations. I keep hitting issues, and I'm pulling my hair out a bit. I have moderate clojure experience, but none with the js ecosystem. I'd appreciate some pointers! I figure expo would be the easiest entrypoint. However:

❯ lein new expo your-project +reagent
Generating fresh Expo project.
README.md contains instructions to get you started.
If you have any questions, you can ask us on Clojurians #cljsrn channel. <http://clojurians.net>
❯ cd your-project
❯ yarn install
yarn install v1.22.10
warning ../package.json: No license field
info No lockfile found.
[1/4] Resolving packages...
warning expo &gt; fbemitter &gt; fbjs &gt; core-js@1.2.7: core-js@&lt;3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native &gt; fbjs &gt; core-js@2.6.12: core-js@&lt;3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native &gt; fbjs-scripts &gt; core-js@2.6.12: core-js@&lt;3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native &gt; metro-babel-register &gt; core-js@2.6.12: core-js@&lt;3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native &gt; @react-native-community/cli &gt; metro &gt; metro-minify-uglify &gt; uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
warning react-native &gt; @react-native-community/cli &gt; metro &gt; jest-haste-map &gt; sane &gt; fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-native &gt; @react-native-community/cli &gt; metro &gt; jest-haste-map &gt; sane &gt; micromatch &gt; snapdragon &gt; source-map-resolve &gt; resolve-url@0.2.1: <https://github.com/lydell/resolve-url#deprecated>
warning react-native &gt; @react-native-community/cli &gt; metro &gt; jest-haste-map &gt; sane &gt; micromatch &gt; snapdragon &gt; source-map-resolve &gt; urix@0.1.0: Please see <https://github.com/lydell/urix#deprecated>
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native &gt; metro-react-native-babel-transformer@0.51.0" has unmet peer dependency "@babel/core@*".
warning "react-native &gt; @react-native-community/cli &gt; metro-react-native-babel-transformer@0.51.1" has unmet peer dependency "@babel/core@*".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 11.18s.
❯ lein figwheel
Source maps enabled.
Figwheel: Starting server at <http://0.0.0.0:3449>
Figwheel: Watching build - main
Figwheel: Cleaning build - main
Compiling build :main to "target/expo/index.js" from ["src" "env/dev"]...
Successfully compiled build :main to "target/expo/index.js" in 11.065 seconds.
Launching ClojureScript REPL for build: main
Figwheel Controls:
          (stop-autobuild)                ;; stops Figwheel autobuilder
          (start-autobuild id ...)        ;; starts autobuilder focused on optional ids
          (switch-to-build id ...)        ;; switches autobuilder to different build
          (reset-autobuild)               ;; stops, cleans, and starts autobuilder
          (reload-config)                 ;; reloads build config and resets autobuild
          (build-once id ...)             ;; builds source one time
          (clean-builds id ..)            ;; deletes compiled cljs target files
          (print-config id ...)           ;; prints out build configurations
          (fig-status)                    ;; displays current state of system
          (figwheel.client/set-autoload false)    ;; will turn autoloading off
          (figwheel.client/set-repl-pprint false) ;; will turn pretty printing off
  Switch REPL build focus:
          :cljs/quit                      ;; allows you to switch REPL to another build
    Docs: (doc function-name-here)
    Exit: :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application
... and it just hangs, indefinitely.

Dominic Pearson 2021-05-04T08:08:21.121800Z

seems this missing figwheel-main.edn was the issue. couldn't see it referenced in any of the guides, though maybe I missed something.

Dominic Pearson 2021-05-04T08:08:39.122Z

thanks so much!

👍 1
raspasov 2021-05-04T12:58:36.124300Z

Glad it works!

Dominic Pearson 2021-05-03T20:12:57.111100Z

When experimenting with react-native-figwheel-bridge, I kept running into issues with Error: Can't resolve './Libraries/Components/AccessibilityInfo/AccessibilityInfo' and similar. None of the 'out-of-the-box' instructions seem to work for me. Am I doing something horribly wrong?

Dominic Pearson 2021-05-03T20:14:16.111500Z

(figwheel-bridge optionsUrl also cannot be fetched: [Error: Figwheel Bridge Unable to fetch optionsUrl: http://localhost:19001/target/public/cljs-out/android/cljsc_opts.json])

Dominic Pearson 2021-05-03T20:17:35.113600Z

My previous experience was mostly plain clj projects, and am familiar with lein. Plain react native projects have no problem with my setup, launching in the emulator without problems. Am running on Linux.

naomarik 2021-05-03T20:22:56.113700Z

try shadow-cljs, was extremely easy for me to get a new setup going

Dominic Pearson 2021-05-03T20:54:50.113900Z

I dunno. I tried with shadow-cljs, certainly not intuitive how to get it set up to launch anything in an android emulator. It isn't even mentioned in the user guide.

Dominic Pearson 2021-05-03T20:56:13.114100Z

Trivial to go from 0 to browser REPL, but as for later tooling, official docs seem thin on the ground.

naomarik 2021-05-03T22:40:00.114300Z

from my recent experience shadow-cljs let me make extremely minimal changes on a brand new app created with react-native's cli tools and there's tons of documentation around how to get things running on simulators there, all works for me

naomarik 2021-05-03T22:40:24.114500Z

compared to my experience awhile ago when using re-natal, it's enormously easier