Fork me on GitHub
#clojurescript
<
2017-09-13
>
cjhowe01:09:26

i use both of those and had to add [com.google.guava/guava "21.0"] to my deps

richiardiandrea01:09:51

so clj->js does not transform #uuid tags, is there a way to do that automatically?

tony.kay01:09:59

@dpsutton If you mean beyond cljs.test, try fulcro-spec. It’s built on top of cljs/clojure test, but adds some handy things.

dpsutton01:09:36

i guess just about setting up autmatic local runners, jenkins runners, etc

dpsutton01:09:52

my work doesn't have cljs tests but does have clj tests and i would like to change that

tony.kay01:09:20

So, try out the fulcro lein template. It is set up with clj and cljs test, dev mode is accomplished in a nice browser UI (hot code refresh/re-run). CI tests are part as well. The README you get describes the bits:

lein new fulcro my-project

dpsutton01:09:36

thanks. i'll check it out tomorrow

tony.kay01:09:06

Fulcro-spec is a standalone that can be used for testing in any project. Fulcro itself is a full-stack SPA system.

anmonteiro02:09:05

@richiardiandrea clj->js has nothing to do with #uuid tags really

anmonteiro02:09:09

they’re JS objects

anmonteiro02:09:11

but you can probably extend-protocol IEncodeJS to the UUID type

richiardiandrea02:09:17

Oh that is what I was looking for yep. I figured I needed a custom writer, thanks!

richiardiandrea02:09:16

Actually I would probably want to customize how the key is treated really, more than relying on uuid tags really. So I'll probably use key->js.

cemerick04:09:10

I have followed the instructions @ https://clojurescript.org/tools/repls to the letter (copy-pasted a repl.clj file and launched the REPL using it), but I still don't have CLJS-oriented file/line number info in stack traces. What things should I check for to diagnose the problem?

anmonteiro04:09:05

@cemerick are you targeting Node.js?

anmonteiro04:09:38

^ weird question. better: is the REPL evaling in Node.js?

cemerick04:09:05

@anmonteiro yes, sorry, using node 6.10.3, if that matters

anmonteiro04:09:18

make sure you have installed source-map-support

anmonteiro04:09:24

npm install source-map-support

cemerick04:09:06

oh! look at that

cemerick04:09:34

was I supposed to know that?

anmonteiro04:09:51

I don’t think so

anmonteiro04:09:13

I remember this being written down somewhere

anmonteiro04:09:21

perhaps didn’t make it from the wiki to the website

anmonteiro04:09:33

it’s unfortunate how bad the GitHub search is

cemerick04:09:12

this is probably common knowledge for anyone that uses node.js as it was intended, etc

anmonteiro04:09:21

it’s not in the wiki as well

cemerick04:09:25

I basically use it as a CLJS black box

cemerick04:09:45

ok, so that mostly works!

anmonteiro04:09:13

yeah, it’s not very good, but at least it’ll tell you the line number

cemerick04:09:26

it looks like the source-map-support is only looped in for namespaced loaded after the ((.. (node/require "source-map-support") -install)) call

anmonteiro04:09:29

source maps are much better in the browser /JavaScriptCore

anmonteiro04:09:56

the ClojureScript Node.js REPL should generate that call

cemerick04:09:07

I'll do a clean of the output-dir and try again

anmonteiro04:09:40

@cemerick delete .cljs_node_repl in your project dir too

cemerick04:09:53

I would so love to get all that guff under target so it gets flushed with everything else

cemerick05:09:54

@anmonteiro looking good, very nice, thank you :thumbsup:

cemerick05:09:07

I'll pop over with a PR for that page tomorrow

cemerick05:09:44

oh, looks like source-map-support is documented after all, in the node section of the quick start: https://clojurescript.org/guides/quick-start#running-clojurescript-on-node.js

cemerick05:09:43

@anmonteiro ☝️ just FYI. Thanks again 🙂

anmonteiro05:09:05

ah I thought I had seen it somewhere

pvillegas1211:09:46

What is a good tutorial for creating an web app with clojure + clojurescript?

hlolli11:09:13

@pvillegas12 can you be more specific, many tutorials out there that teach many different aspects of creating web app in broad sense.

sivakumargsk11:09:56

i am using google reCaptcha (https://developers.google.com/recaptcha/). Its works fine in development mode. but it doesn't works in production mode. That is because of foreign-libs.

hlolli12:09:50

@sivakumargsk if you are asking a question, then I'd check if the externs you are providing are up to date, if you don't have externs, you probably need to make them. Also, there are more genders here than "guys", this is a habit I also had to get rid off.

sivakumargsk12:09:24

@hlolli i write an externs file also it contains var grecaptcha = { "render": function () {}, "reset": function () {}, "getResponse": function () {}, "execute": function () {} }

hlolli12:09:35

Looks like this library isn't providing any js functions, so there isn't much reason to include it in foreign libs if you can avoid it, just add <script src='https://www.google.com/recaptcha/api.js'></script> and give your dom elements the right class names etc. Also in case google updates their js file, then you don't need to do anything on your side.

pvillegas1212:09:17

@hlolli building a web app specifically using clojure as a backend (ring?) + cljs, I’m familiar with other backends + frontend technologies

hlolli12:09:59

Ok, you'd want to check out ring and compojure. And routers bidi offers a good backend/frontend routing. Om-next has in my opinion the most beautiful data oriented GraphQL-ish endpoints via its om.next/parser. Looking at datomic tutorials you can learn also about other querying languages (pull-syntax) along with datascript (not connected to datomic).

dnolen15:09:39

@kingmob that how the Node modules stuff works, via Google Closure Compiler’s support for it, worth reading the http://clojurescript.org/news blog for details

Matthew Davidson (kingmob)16:09:47

@dnolen Yeah, I’ve been poring over them nonstop since yesterday. It’s tricky because there’s important details that are scattered around and older pages that haven’t been brought up-to-date yet. E.g., the http://clojurescript.org Dependencies page still says about :foreign-libs that “Foreign libraries are included in your final output, but are not passed through advanced compilation”, though my understanding is that setting :module-type under :foreign-libsmeans the library will go through advanced compilation, according to the Javascript Module Support page.

Roman Liutikov16:09:06

Been rereading latest cljs news blog and wondering which "higher level composable facilities" can be built on top of cljs.loader? > This simplification now means downstream libraries can easily build higher level composable facilities upon cljs.loader.

Roman Liutikov16:09:52

For example in JS you have routing library which allows you to define route-based code splits (dynamic imports which are processed by Webpack). But it seems like it's not possible in cljs, since everything should be defined statically.

mitchelkuijpers16:09:55

@roman01la we do route-based code splits with fulcro

mitchelkuijpers16:09:05

We have a edn file which defines all the routes and namespaces and then we generate the :modules part for the clojurescript compiler and stuff for fulcro with a macro

Roman Liutikov17:09:49

Sounds interesting. How do you generate split namespaces?

thheller17:09:59

@kingmob the :npm-deps stuff is a replacement for :foreign-libs and should not be used together. well only if you have your own js that you want to convert, but not for packages

Matthew Davidson (kingmob)17:09:18

@thheller Got it. In our case, we’re more of a plugin than in charge of the .js on the page, so we can’t feed everything through Closure :advanced. In the short run, I’m going to push to do more of our builds outside lein, and in the long run, maybe we can produce a build where cljs is in control.

len18:09:57

I am just getting started with a clojusrescript node project, needs to host some http services, is there a good place to start looking for docs / examples ?

Zor19:09:29

@len I was looking into the same thing recently. This ended with "mmh I want to try macchiato" https://github.com/macchiato-framework. I settled for doing my http service with clojure/ring, so I can't speak much more about macchiato

richiardiandrea19:09:33

Question, which options is https://cljs.github.io/api/cljs.core/pr-str-with-opts accepting and how do they modify the behavior of pr-str?

richiardiandrea19:09:29

(is it worth using?)

thheller20:09:11

@richiardiandrea I think there is (pr-opts) or something like that for the default opts. It is related to the IPrintWithWriter protocol and which effect the opts have is dependent pretty much on each individual protocol implementation

richiardiandrea20:09:24

Ok thanks, will dig into the source