fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
yubrshen 2021-05-23T04:27:37.027800Z

Has anyone succeeded in getting https://github.com/fulcro-community/fulcro-exercises/ working for the 0 step with emacs? When I executed M-x cider-connect-cljs it connects to the shawdow-cljs server and the REPL's namesapce was set to cljs.user. But I when I evaluated

cljs.user> (shadow/repl :main)
------ WARNING - :undeclared-ns ------------------------------------------------
 Resource: <eval>:1:2
 No such namespace: shadow, could not locate shadow.cljs, shadow.cljc, or JavaScript source providing "shadow"
--------------------------------------------------------------------------------

------ WARNING - :undeclared-var -----------------------------------------------
 Resource: <eval>:1:2
 Use of undeclared Var shadow/repl
--------------------------------------------------------------------------------
then when I evaluated the namespace holyjak.fulcro-exercises I got no feedback of success, nor feedback of error. then when I modified the step 0 as follows:
(do ;; comment ; 0 "Try it out!"
  (do
    (defsc Root0 [_ _]
      (h1 "Hello, I am a Fulcro app from the exercise 0!"))

    ;; Send this whole `do` to the REPL. Do you see the UI change in the browser?
    (render! Root0)

    (comment ; try running the hint fn 3 times!
      (hint 0)
      (hint 0)
      (hint 0))

    nil))
After saving the file, I got an error at the shadow-cljs server web page at http://localhost:8000/ shadow-cljs - [reload failed] Failed to load holyjak/fulcro_exercises.cljs: nil passed to get-query I found no other error nor feedback.

yubrshen 2021-05-23T16:04:41.028200Z

But I am able to get repl working with Cursive. And with Cursive, I can manually execute functions and get the expected behavior at the web page and the repl output buffer. So the problem is just related to emacs of connecting to cljs/shadow-cljs buffer.

Jakub Holý 2021-05-23T17:37:22.028800Z

Are you sure that cider-connect-cljs does what you expect? I thing what you should actually do is to starta clj REPL connecting to the running shadow repl and then run (shadow/repl :main) from that shadow clojure repl to connect to the cljs REPL. But #shadow-cljs might be a better place to get advice.

yubrshen 2021-05-30T01:19:39.063400Z

Yes, cider-connect-cljs is the command to connect to externally started REPL. I found a solution. It requires additional dependency to cider.nrepl. Here is the details: https://yubrshen.github.io/20210529164328-deps_edn_for_clojurescirpt_shadow_cljs_be_connectable_with_cider_connect_cljs.html

🎉 1
Jakub Holý 2021-05-31T18:58:37.070600Z

@yubrshen could you be so kind and check whether the updated instructions and deps work for you out of the box? See https://github.com/fulcro-community/fulcro-exercises/pull/3/files (if you have cloned the repo before, then you can fetch and check out the fix/cider-support branch. Thank you!!!

🙌 1
yubrshen 2021-05-31T19:01:16.070800Z

Sure. I'll.

🙏 1
yubrshen 2021-06-01T14:59:29.083300Z

Yes, following your instruction, after starting REPL by clojure -M:cider:serve then from emacs with M-x cider-connect-cljs then, I can evaluate ClojureScript code in the project's source code buffer. Thanks for a very clearn accomodation! (In my experiement, cider/piggieback {:mvn/version "0.5.1"} is not necessary.)

yubrshen 2021-06-01T15:11:24.083800Z

On another note, in shadow-cljs.edn, should :deps {:aliases [:dev]} be :deps {:aliases [:serve]} as the required dependencies for shadow-cljs.edn from deps.edn is defined by :serve I tried to start REPL within emacs M-x cider-jack-in-cljs It seemed the above fix is needed.

Jakub Holý 2021-06-02T09:47:16.115300Z

Thanks a lot! Deps: I will just remove the alias, it can perhaps cause problems if it is not defined on your machine (I have it in my global deps.edn). The :serve deps are not required by shadow in my experience.