Fork me on GitHub
#clojurescript
<
2022-09-30
>
Siddarth Kumar11:09:56

Does anyone have any links of blogs or videos of making clojure script work with react native that is not outdated? Most of the stuff I find is outdated and does not work with latest versions. Bonus if it's done with shadow-cljs 🙏:skin-tone-2:

thomas14:09:18

there is a #react-native channel and if I am not mistaken there is something called krell..

thheller15:09:57

can you elaborate on what doesn't work? the integration is quite simple and should just work?

Siddarth Kumar15:09:01

Sure I'm afk but Il share detailed logs once I get a chance

dvingo16:09:05

anyone know if devcards (https://github.com/bhauman/devcards) is abandoned? There's some pretty simple npm dependency updates needed to get it working with modern cljs tooling, everytime I touch a project that uses it I have to figure out which stale highlight.js and marked versions are needed to make it happy. It also seems like modern shadow-cljs versions are broken with highlight.js, so have to downgrade shadow-cljs too.. shadow error on 2.20.2:

Errors encountered while trying to parse file
  /Users/dev/projects/cljs-styled-components/node_modules/highlight.js/lib/languages/isbl.js
  {:line 1, :column 1, :message "The file could not be parsed as JavaScript."}

RuntimeException: Exception parsing "/Users/dev/projects/cljs-styled-components/node_modules/highlight.js/lib/languages/isbl.js"
	com.google.javascript.jscomp.parsing.ParserRunner.parse (ParserRunner.java:148)
	com.google.javascript.jscomp.JsAst.parse (JsAst.java:157)

syd21:09:24

Hi there, I’ve been playing with cljs and boot and cider but I got an error issuing (start-repl) right after cider-jack-in

java.lang.NullPointerException: Cannot invoke "java.io.File.getParentFile()" because the return value of "clojure.core$apply.invokeStatic(Object, Object, Object)" is null
    clojure.lang.ExceptionInfo: Unexpected error during REPL initialization

syd21:09:22

java:

openjdk version "1.8.0_345"
OpenJDK Runtime Environment (build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (build 25.345-b01, mixed mode)
build.boot:
(set-env!
 :source-paths #{"src"}
 :resource-paths #{"html"}
 :dependencies '[[org.clojure/clojure "1.11.1"]
                 [org.clojure/clojurescript "1.11.60"]
                 [adzerk/boot-cljs "2.1.5"]
                 [pandeiro/boot-http "0.8.3"]
                 [adzerk/boot-reload "0.6.1"]
                 [adzerk/boot-cljs-repl "0.4.0"]
                 [cider/piggieback "0.4.2"]
                 [weasel/weasel "0.7.1"]
                 [nrepl/nrepl "1.0.0"]])

(require '[adzerk.boot-cljs :refer [cljs]]
         '[pandeiro.boot-http :refer [serve]]
         '[adzerk.boot-reload :refer [reload]]
         '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]])

(task-options!
  repl {:middleware '[cider.piggieback/wrap-cljs-repl]})

(deftask dev
  "Launch Immediate Feedback Development Environment"
  []
  (comp
    (serve :dir "target")
    (watch)
    (reload)
    (cljs-repl)
    (cljs)
    (target :dir #{"target"})))

p-himik21:09:37

Does that error have a stacktrace?

syd21:09:55

I might be wrong, you mean this?

Show: Project-Only All 
  Hide: Clojure Java REPL Tooling Duplicates  (5 frames hidden)

2. Unhandled clojure.lang.ExceptionInfo

1. Caused by java.lang.NullPointerException
   Cannot invoke "java.io.File.getParentFile()" because the return
   value of "clojure.core$apply.invokeStatic(Object, Object, Object)"
   is null

                    io.clj:  443  
                    io.clj:  438  
               RestFn.java:  410  clojure.lang.RestFn/invoke
        boot_cljs_repl.clj:   43  adzerk.boot-cljs-repl/make-repl-connect-file
        boot_cljs_repl.clj:   41  adzerk.boot-cljs-repl/make-repl-connect-file
        boot_cljs_repl.clj:   62  adzerk.boot-cljs-repl/write-repl-connect-file
        boot_cljs_repl.clj:   57  adzerk.boot-cljs-repl/write-repl-connect-file
        boot_cljs_repl.clj:  101  adzerk.boot-cljs-repl/repl-env/fn
             websocket.clj:   72  weasel.repl.websocket/websocket-setup-env
             websocket.clj:   60  weasel.repl.websocket/websocket-setup-env
             websocket.clj:   27  weasel.repl.websocket.WebsocketEnv/_setup
                      REPL:   64  boot.user.Delegatingweasel-repl-websocket-WebsocketEnv/_setup
                 repl.cljc: 1127  cljs.repl$repl_STAR_$fn__8053/invoke
             compiler.cljc: 1477  cljs.compiler$with_core_cljs/invokeStatic
             compiler.cljc: 1466  cljs.compiler$with_core_cljs/invoke
                 repl.cljc: 1125  cljs.repl$repl_STAR_/invokeStatic
                 repl.cljc: 1033  cljs.repl$repl_STAR_/invoke
       piggieback_impl.clj:  112  cider.piggieback/run-cljs-repl
       piggieback_impl.clj:  106  cider.piggieback/run-cljs-repl
       piggieback_impl.clj:  152  cider.piggieback/cljs-repl
       piggieback_impl.clj:  134  cider.piggieback/cljs-repl
               RestFn.java:  410  clojure.lang.RestFn/invoke
                  AFn.java:  154  clojure.lang.AFn/applyToHelper
               RestFn.java:  132  clojure.lang.RestFn/applyTo
                  Var.java:  705  clojure.lang.Var/applyTo
                  core.clj:  669  clojure.core/apply
                  core.clj:  662  clojure.core/apply
        boot_cljs_repl.clj:  115  adzerk.boot-cljs-repl/start-repl
        boot_cljs_repl.clj:  105  adzerk.boot-cljs-repl/start-repl
               RestFn.java:  397  clojure.lang.RestFn/invoke
                      REPL:   94  boot.user/eval12776
                      REPL:   94  boot.user/eval12776
             Compiler.java: 7194  clojure.lang.Compiler/eval
             Compiler.java: 7149  clojure.lang.Compiler/eval
                  core.clj: 3215  clojure.core/eval
                  core.clj: 3211  clojure.core/eval
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  667  clojure.core/apply
                  core.clj: 1990  clojure.core/with-bindings*
                  core.clj: 1990  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn
                  main.clj:  437  clojure.main/repl/read-eval-print/fn
                  main.clj:  437  clojure.main/repl/read-eval-print
                  main.clj:  458  clojure.main/repl/fn
                  main.clj:  458  clojure.main/repl
                  main.clj:  368  clojure.main/repl
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   84  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   56  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  152  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  218  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  217  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java: 1589  java.lang.Thread/run

p-himik21:09:21

Judging by the code, you should call cljs-repl-env at some point. At which point I don't know though - I barely used boot something like 8 years ago and I definitely wouldn't recommend using it nowadays, if that's an option.

leif22:09:43

I am trying (and failing) to use a custom cljs.tools.reader library in a ClojureScript Project. I have the following deps.edn file:

{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
        org.clojure/clojurescript {:mvn/version "1.11.60"}
        org.clojure/tools.reader {:local/root "/home/leif/src/tools.reader"}}
 :aliases {:run {:main-opts ["-m" "cljs.main" "--compile"
                             "sample.core" "--repl"]} }
 :paths ["src"]}
And samp.core is:
(ns samp.core
  (:require
   [cljs.tools.reader :refer [read read-string]]))
But whenever I build this (with clojure -M:run , I get the following error:
Exception [...]
Caused by: clojure.lang.ExceptionInfo: No such namespace: cljs.tools.reader, could not locate cljs/tools/reader.cljs, cljs/tools/reader.cljc, or JavaScript source providing "cljs.tools.reader" in file /home/leif/src/is-small/src/samp/core.cljs {:tag :cljs/analysis-error}
	at cljs.analyzer$error.invokeStatic(analyzer.cljc:780)
	at cljs.analyzer$error.invoke(analyzer.cljc:776)
	at cljs.analyzer$error.invokeStatic(analyzer.cljc:778)
	at cljs.analyzer$error.invoke(analyzer.cljc:776)
	at cljs.analyzer$analyze_deps.invokeStatic(analyzer.cljc:2736)
	at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:2703)
	at cljs.analyzer$ns_side_effects.invokeStatic(analyzer.cljc:4228)
	at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:4223)
	at cljs.analyzer$analyze_STAR_$fn__3858.invoke(analyzer.cljc:4350)
	at clojure.lang.PersistentVector.reduce(PersistentVector.java:343)
	at clojure.core$reduce.invokeStatic(core.clj:6827)
	at clojure.core$reduce.invoke(core.clj:6810)
	at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:4350)
	at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:4341)
	at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:4369)
	... 24 more

leif22:09:56

(Note that I am using local/root for tools.reader, when I replace it with {:mvn/version "1.3.6"} it works fine.

bronsa22:09:17

src/main/cljs is not included in the paths for t.r's deps.edn , which I assume local/root would use

leif22:09:01

@bronsa It is in the tools.reader deps.edn file.

leif22:09:26

(I have the latest head checked out in the folder /home/leif/src/tools.reader, so I would imagine it should be a compatible version.)

leif22:09:53

Ah, you're right.

leif22:09:20

So then, why does it work at all when I switch to {:mvn/version "1.3.6"}?

bronsa22:09:54

because the published jar is not built using the deps.edn , in that repo it's only there for dev convenience (and I only used it for clojure)

leif22:09:23

Ah, when I add src/main/cljs to the paths the error seems to go away

leif22:09:25

So thanks. 😄