Fork me on GitHub
#clojurescript
<
2018-06-25
>
vikeri10:06:34

Preparing a talk where I present the most popular frontend frameworks (popular as defined by how many project.clj or build.boot files I find on github). I’ve found the following so far:

reagent 4250
re-frame 2251
om/om.next 1600
hoplon 486
rum 477
Missing any with more than ~500 usages? I used the following query: https://github.com/search?q=re-frame+filename%3Aproject.clj+filename%3Abuild.boot&amp;type=Code

hoplon 4
borkdude10:06:01

I think reagent and re-frame are complementary, but those statistics wouldn’t surprise me, seem realistic

vikeri10:06:14

For reagent I excluded re-frame results

borkdude10:06:56

Maybe fulcro, keechma? Hmm, less than 100.

borkdude10:06:28

quiescent has 117

martinklepsch12:06:56

om/om next could (should?) be split

richiardiandrea17:06:56

is there a way to conditionally require a namespace based on a goog-define?

mfikes17:06:42

@richiardiandrea I don't think so. This is because all requires are processed up front (in order to define the compilation partial order, for example)

👍 4
richiardiandrea17:06:23

so maybe I am approaching the problem in the wrong way 😉

thheller17:06:16

all requires are static. you can do conditional requires via the reader in shadow-cljs. https://shadow-cljs.github.io/docs/UsersGuide.html#_conditional_reading.

richiardiandrea17:06:35

yep I am aware of reader conditionals but my use case is kind of different - I want to require either the AWS sdk if a goog-define says aws or the Azure sdk otherwise

thheller17:06:14

not possible purely in code, going to need help from the build tool. either via reader conditionals or :js-options :resolve

👍 4
pesterhazy17:06:06

you can have two different classpaths

richiardiandrea17:06:49

yeah shadow does not like 😉

pesterhazy17:06:24

two folders, with the same file andrea/backend.cljs which has different requires

pesterhazy17:06:42

two project.clj builds can then have two different classpaths

richiardiandrea17:06:42

yeah I can do that I think still feel that it could be improved with conditional condionals reader 🙂

thheller17:06:44

you could also do it via different entries. one build with your.app.aws and the other with your.app.azure, both setting up the proper env and passing a protocol impl to your actual main

richiardiandrea17:06:55

this latter is the idea i had in mind

mfikes18:06:07

If you are employing :advanced then perhaps you could just require both namespaces, and let goog-define result in DCE. (If that is even important for your use case.)

mfikes18:06:18

Meaning, wrap the use of the APIs in if or cond based on goog-define

richiardiandrea23:06:06

I think this latest one is the one I had in mind, wondering if I need a macro there though for the goog-define if. I am trying that right now

leongrapenthin18:06:48

they have a thing in npm /js world where packages start with "@". can we require this already?

leongrapenthin18:06:27

ah we can with string syntax nvmd

dnolen18:06:06

it doesn’t work :npm-deps due to a Closure bug

mfikes18:06:48

PSA: If you get a NoSuchMethodError regarding Transit when using the recently-released ClojureScript 1.10.339, it is solvable by updating transit-clj to 0.8.309 (or by letting ClojureScript transitively define the version)

4
pesterhazy19:06:45

Can anyone recommend any publicly available CLJS applications (not libraries)? So far I have maria, vimsical and status-react

pesterhazy19:06:56

can't believe I missed those two

mfikes20:06:42

ClojureScript REPLs now auto-load user.cljs or user.cljc, which is useful for setting up dev-time facilities. See more at https://clojurescript.org/reference/repl#auto-loaded-user-code

ingesol09:06:14

Hi! This is really great! I'm trying to do this with cljs 1.10.339 in figwheel 0.5.16 running in cursive. Getting a warning about user being a single segment namespace. Also not able to call a demo function I made in that namespace from the REPL. I'm assuming this is something that needs a fix in figwheel, @bhauman?

ingesol11:06:36

Anyone else with a working example of the new user.cljs feature? Did I just misunderstand this?

bhauman11:06:28

@U21QNFC5C is the warning from figwheel or is it from the compiler? OR can you show me the warning that you are getting?

mfikes12:06:12

@U21QNFC5C By default it will assume cljs.user is the namespace. But, you can put (ns cljs.user) (or whatever you like in there). Perhaps you put (ns user), which is less useful for ClojureScript (because your REPL starts in cljs.user)

ingesol12:06:35

I was about to answer @bhauman, but I see that you are right, @U04VDQDDY. Using cljs.user works, also with figwheel reload

ingesol12:06:09

I did put (ns user), which is the thing that makes the cursive editor happy. Get a red marker now, but I guess I can live with that 🙂

mfikes12:06:28

You can even omit (ns cljs.user)

ingesol12:06:58

Thanks guys, this feature is the most significant clojure infrastructure improvement for me and my team in a long time

mfikes12:06:30

Cool. (I'm surprised how well that feature is received.)

ingesol12:06:32

When introducing new developers to the CLJS REPL, it's a huge benefit to get a REPL that is preset with convenience features for our app.

ingesol13:06:03

Also, omitting the (ns cljs.user) didn't work for me. If you're interested, I could investigate further and give more details.

pesterhazy20:06:32

That’s huge!

pesterhazy20:06:44

I’ve wanted that for years