clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
javi 2021-06-28T09:04:06.038900Z

Hi , in clj or cljs extra data readers are loaded from a data-readers.clj file at the root. For example in https://github.com/weavejester/hashp How would I go about adding those same readers in self-hosted cljs? I have found register-tag-parser! in reader but that seems to only apply when (reader/read-string {:some-k "some val"}) My case is in a live editor sending render of components to different divs based on the reader tag.

#r1 [a-com opts-1]
#r2 [a-com opts-2]
thanks in advance

thheller 2021-06-28T10:00:00.040100Z

@fj.abanses pretty sure the self-hosted compiler uses this binding https://github.com/clojure/clojurescript/blob/017ce8812d9b73f5df076b20e818e0ae90b90812/src/main/clojure/cljs/tagged_literals.cljc#L87, so you can probably just bind that when you invoke the compiler? maybe the compile functions also take that as an arg?

javi 2021-06-28T10:12:25.042Z

thanks for the pointer @thheller , i am looking into it at the moment.

javi 2021-06-28T10:32:45.042900Z

@thheller many thanks. A first quick test shows that the approach works. <using shadow-cljs here>

(defn eval-str [source cb]
  (binding [*cljs-data-readers* (merge *cljs-data-readers* {'r1 (fn [form] (str form))})]
    (cljs/eval-str
    c-state
    source
    "[test]"
    {:eval cljs/js-eval
     :load (partial boot/load c-state)
     :ns   (symbol project-ns)}
    cb)))

West 2021-06-28T19:39:33.050800Z

Does anyone here have experience publishing projects to the npm repository?

thheller 2021-06-28T19:43:15.051Z

you mean like the shadow-cljs npm package? 😛

West 2021-06-28T22:07:44.052400Z

The reason I ask is because I’m trying to automate versioning, releasing, and publishing to npm via circleci. It looks like you’ve automated building and testing @thheller. Do you do these steps manually?

2021-06-28T22:14:30.053Z

I think you can just connect a Github repository to NPM as well, and it would update the NPM as soon as a new tag is released on Github.

😮 1