This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (32)
- # boot (15)
- # cljs-dev (200)
- # cljsjs (1)
- # cljsrn (18)
- # clojure (4)
- # clojure-austin (2)
- # clojure-spec (6)
- # clojure-uk (8)
- # clojurescript (69)
- # cloverage (1)
- # cursive (12)
- # datomic (1)
- # dirac (37)
- # emacs (1)
- # hoplon (38)
- # off-topic (3)
- # om (19)
- # om-next (1)
- # onyx (4)
- # parinfer (2)
- # perun (27)
- # protorepl (4)
- # re-frame (5)
- # rum (9)
- # spacemacs (8)
- # untangled (2)
Hey y’all. 🙂 Quick non-scientific poll question: I’m starting a new ClojureScript project with Om Next, and haven’t really been able to find any new blog posts, Reddit threads or tweets on the best Clojure server-side framework for React/React-Native CLJS apps as of late 2016. I did see both the Om Next demo, CircleCi’s frontend and the Precursor app now open-sourced all use Ring. But I’m not sure if there’s a general consensus now given all the activity in the community as of late, if one were to start a new Om Next project from scratch, what the simplest (in Rich Hickey/David Nolen terms) framework of choice is now. Pedestal has the backing of Cognitect, Arachne is almost ready for alpha, and new things like Duct and Luminus have popped up, etc. Thoughts on if Ring is still the way to go? Would seriously appreciate any input for a newbie. 🙂 Thanks in advance!
@keatondunsford it is really tough to answer to these kind of questions, there is a mix of things in it. Probably the first thing to understand for you would be if you want to go for a pre-packaged solution or not. By pre-packaged I mean
pedestal mainly, which are super battle tested. The other option is to just adding libs to a bare-bone project, which might be scary but for sure more rewarding in terms of understanding what the moving parts are.
Additionally, if you are going for a REST app,
ring can be a good choice if you want to take the super safe way. An alternative to the
ring architecture is
yada. I am sure I am forgetting many other alternatives actually but these are the ones I went for in the last two years+ of my Clojurism 🙂 Last piece of advice I can give is to ask as well to #beginners.
I’ll totally do that. 🙂 My intuition is to trust whatever Cognitect is backing. Counterargument I guess would be to use whatever is the most composable, which sounds like it’s Ring. Kind of like the Boot > Leiningen argument for long-term projects.
@keatondunsford right, that's a good analogy 😄 It also depends on what is the scope of your app and many other things, I kept my answer very short 😉
Haha yeah for sure. 🙂 If this project does go well, which is the intention, I am hoping to scale it and take it on as a startup. The high-level concept I’m working on is to essentially build “Reddit meets Snapchat stories and Tinder” for creating project-based communities around video tutorials on any subject (like building flying cars, or making rap beats, or a new VR video game), and then try and connect people physically who are near each other’s locations and want to make the same cool things together in person. So architecture wise, I’ve been looking into separating a lot of the different backend pieces via microservices in Dockerized containers all connected by RESTful APIs. Which it sounds like Pedestal is sort of designed for out-of-the-box.
I have not used pedestal yet in a project so I can't comment on that. Just one thing I would suggest, as Rich said, not everything is awesome..so I'd evaluate very very deeply how it has been designed before a buy-in. Of course, if it matches your requirements above, then it is the right choice for you 😉
Sounds good. 🙂 Thanks so much for the help!
you're welcome! 🙂
Hi guys; I would be glad to know if there is a non interop method to load css or js resourses ?
is it possible to eval cljs from js?
@thedavidmeister I'm not sure we can. I've used only "^:export" though.
@thedavidmeister but you can check this out http://blog.klipse.tech/clojure/2016/03/17/klipse.html
mmm that’s cool
i just wanted to be able to run some cljs with selenium >.<
@thedavidmeister ya it would be redundant to use klipse plugin. I wonder you could use selenium cljs plugins to do that. It's just a suggestion infact I haven't done that.
not sure, i know that i can execute js
i wondered if i could do something like
(execute-script “cljs.core.eval(‘(prn 1)’)”)
but that doesn’t work
@thedavidmeister: there is no
@darwin i’m trying to test some code i wrote that relies on the js/window object, do you think this is a good way to approach that?
@thedavidmeister I’m sorry, I don’t understand your question. What is “this way”? And how is code which relies on
js/window different from any other code from the testing point of view?
@darwin well, normally when i test some clj or cljs i can pass data to the functions i’m testing and see what comes back
but js/window comes from the browser the js runs in
so not sure how to “get at” it
js/window is available.
tests are written in clj
actually it’s just a bit slow and tests can be flaky
so i wanted to start looking at alternatives, for at least some of the tests i wrote this way
you have to use clj-webdriver’s api to query browser state, I’m not aware of any way how to inspect
was looking at
which led to me needing to write js, which led to me asking if i could eval cljs from js...
as I wrote above, you could write a separate cljs project, which will compile your cljs to js, and then you can execute that js
If you wanted to stay using clj-webdriver, you could do something what I did in dirac. You could automate chrome via clj-webdriver to open a page with your tests (again those tests must be in cljs) and then somehow check results via clj-webdriver, it could be as simple as a flag with result code, or something fancy like sending some kind of transcript back and comparing it to expected results: (for inspiration) https://github.com/binaryage/dirac/blob/767bff32d143fb5977d4ca8a6fc204ec33f5a8e6/test/browser/src/browser_tests/dirac/tests/browser/tasks/transcript.clj#L71 https://github.com/binaryage/dirac/tree/767bff32d143fb5977d4ca8a6fc204ec33f5a8e6/test/browser/transcripts/expected
@darwin thanks 🙂 lots for me to look at
@darwin i’m not wedded to clj-webdriver, it just seemed like a straightforward way to get up and running for testing my app
what do you mean by “real tests”?
real test for example goes and checks if
oh right, as in, tests that aren’t treating the cljs being run as a “black box"
@darwin well, i guess it’s time for me to look at upgrading my test suite then 😉
i am starting to hit walls with what i have atm
if you don’t need latest chrome features, I would pick phantomjs, it is easier than selenium (and head-less)
if i’m just testing individual components of the app, which i will be able to, i don’t think i need chrome
@thedavidmeister you might want to look at lein-doo to run front-end unit tests (https://github.com/bensu/doo)
thanks, i’m using boot-cljs-test atm for unit tests
and for integration test, I use a fixture that compiles our app using
cljs.build.api/build together with clj-webdriver
i’m not having any troubles building my app and running clj-webdriver against it with boot 🙂
the thing i’m not doing is running my tests alongside the code run in the browser then exporting the results of the tests back to boot
so i have the same access to the code that i have when running the unit tests, but i’m interacting with the code within the browser @jell
In production I'm using
:optimizations :advanced and in one of my cljs files I'm using
.getBrowserEvent on an instance of
goog.events.BrowserEvent. I've added
:import in my namespace definition, but
.getBrowserEvent is still referred by its full name, whereas in goog libraries it's being minificated.
Is there anything I can do to force this minification on
another theory: there could be an extern covering getBrowserEvent, but that should cause goog libraries to behave the same as your own code, I think
A piece of code that I use:
neither of the two last lines work - both calls to
(fn [evt] (prevent-default evt) (stop-propagation evt) (h (oget (.getBrowserEvent (raw-event evt)) :dataTransfer)) ;(h (-> evt raw-event .getBrowserEvent (oget :dataTransfer))) )
.getBrowserEventare not minificated.