Fork me on GitHub
#clojurescript
<
2015-11-23
>
danielcompton07:11:26

@dnolen: I added a page for how to build the compiler as I couldn’t see the info anywhere else in the wiki https://github.com/clojure/clojurescript/wiki/Building-the-compiler

andrewboltachev09:11:07

Hi. I have function f, which is called with a param :foo, and calls macro m with this param: (defn f [x] (m x)) But the macro seems to receive symbol x, not the keyword :foo. Is that feature of CLJS' macros implementation or I'm doing something wrong possibly?

niwinz09:11:22

I think that is expected

niwinz09:11:03

You are executing the macro inside a function, and the macro receives the not evaluated symbols

dnolen10:11:28

@danielcompton: it exists on the developer pages. Should maybe just link to it

danielcompton10:11:44

@dnolen: Which developer pages? There were other commands in the wiki but I couldn't see script/build

joseph10:11:14

cool, asked by a colleague: what do you think of the advantage of using ClojureScript i node over clojure i JVM?

joseph10:11:12

is it just the difference between nodejs and jvm?

nasser13:11:19

@joseph: the hope is to be able to use clojurescript in environments where dependency on the jvm is cumbersome or impossible, like Electron or embedded systems

joseph13:11:33

@nasser right, thanks for replying.

nasser13:11:43

@joseph: no problem! the other answer to your question is access to the node.js ecosystem

joseph13:11:09

yes, right, node ecosystem is awesome, just considering something about performance or simplicity in both platforms

joseph13:11:56

I guess nodejs wins concerning simplicity.... but not sure other aspects...

dnolen13:11:59

@joseph I would not use bootstrapped stuff if I was targeting clients (like browsers) where code size is a primary concern. iOS, Electron etc. are all targets where size concerns matter less.

joseph13:11:57

@nasser: hmm....good point, agreed

joseph13:11:25

sorry, wrong mentioned, @dnolen , btw, in iOS, do you kind of mean the usage of react-native with cljs?

dnolen13:11:25

@joseph bootstrapped ClojureScript has nothing to do with anything but JavaScript

dnolen13:11:34

you can run it in any JS environment

dnolen13:11:08

so sure you can it in iOS with react-native, but that’s just one possibility

borkdude15:11:37

how does it work when you use a dependency from cljsjs: development vs production?

borkdude15:11:03

never thought about it

dnolen15:11:50

foreign deps are collected and dependecy sorted into a single concatenated string that’s prepended to the final advanced build

dnolen15:11:06

foreign deps can declare a minified source file and these will be used instead if provided

martinklepsch15:11:11

in case of cljsjs minified source is always provided

pbaille16:11:27

hello, i’m searching for the simplest way to use figwheel + ring in cursive, any ideas? so far I’ve tried to adapt chestnut and reagent-template in order to have proper browser REPL whithin cursive but can’t make it work...

kevinmershon16:11:30

@pbaille: What specifically isn't working about figwheel+ring?

kevinmershon16:11:50

I had trouble starting from chestnut last week and got it working with some tweaks to the figwheel config

pbaille16:11:06

I can’t have browser REPL working in cursive

kevinmershon16:11:27

Are you pointing to figwheel's repl or weasel?

pbaille16:11:32

I’ve followed the tutorial in figwheel wiki

pbaille16:11:43

but it doesn’t work

kevinmershon16:11:49

Yeah, but chestnut uses figwheel internals directly, from an old version 0.2.5

kevinmershon16:11:09

The figwheel tutorial is probably oriented for direct usage from the figwheel template, and on version 0.4.1 or 0.5.0

pbaille16:11:24

yes i believe so

pbaille16:11:15

It would be great to have a simple template for figwheel+ring+cursive , I think many people should be interested

kevinmershon16:11:38

@pbaille: Have you worked with figwheel+ring before this project?

pbaille16:11:30

not really, just try some helloworlds in chestnuts and reagent-template

kevinmershon16:11:58

OK. Have you worked in Clojurescript before this project?

jaen16:11:45

If you didn't use figwheel before I suggest trying boot + boot-reload, it's far simpler to get working and integrate with Cursive. Unless you specifically want figwheel that is.

pbaille16:11:48

I’ve done some ring projects and some client project with figwheel

kevinmershon16:11:57

OK, what I was told last week when I was asking similar lines is that I could either go for a full-blown framework like http://www.luminusweb.net/ or it would be a good idea to start from a bare figwheel template and build up from there, instead of starting with chestnut.

grav17:11:27

How do I get Chrome to kill a tab automatically, when I’ve messed up? (I’m not trying to solve the halting problem, just takes ages before Chrome kills a tab by itself, and using the Task Manager is a hassle

kevinmershon17:11:07

I opted to do neither, because luminus was overkill for what I wanted, and figwheel's ring wrapper is really just for development and not good for building an uberjar for production use

pbaille17:11:16

thnak you jaen I will look at boot

martinklepsch17:11:05

@pbaille: I made a template “tenzing”: lein new tenzing … https://github.com/martinklepsch/tenzing

pbaille17:11:12

luminus is really a huge thing, I just want to add a server of my own to a bare figwheel template

jaen17:11:23

Yep, was about to suggest tenzing ; d

jaen17:11:35

There's also saapas for comparison - https://github.com/Deraen/saapas

pbaille17:11:49

@grav yes, when trying to follow it from reagent-template project

grav17:11:48

Okay, I’m doing Reagent dev with Figwheel. I’m using the figwheel template. Adding Reagent is pretty straightforward

pbaille17:11:48

@martinklepsch thank you i will give a try

grav17:11:10

The Ring-part is out of my scope, though simple_smile

grav17:11:31

But I’m using Cursive, though. Very productive toolchain!

pbaille17:11:38

@grav yes but I want to add a ring server instead of built in figwheel's one

grav17:11:10

Ok. But did you get it working without the Ring-part?

roberto17:11:40

has anyone had issues with immuconf not identifying ~ as the home directory?

grav17:11:52

Cool. Maybe try #C0B22RS2Y - the author amongst other is in there

pbaille17:11:46

thank you i will try

roberto18:11:49

I’m having some weird cljs errors when building an uberjar. I’m using cljs 1.170. Everything works fine during dev, but when building the uberjar I get this exception:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.limit(Ljava/io/InputStream;J)Ljava/io/InputStream;, compiling:(/private/var/folders/0m/cjqkxdl50131dgfkz3mnlk300000gp/T/form-init1783542293441291701.clj:1:125)

roberto18:11:12

This is my uberjar profile:

:uberjar {:aot          :all
                     :omit-source  true
                     :source-paths ["src/zoom_recordings/server"]
                     :main         zoom-recordings.server.core
                     :hooks        [leiningen.cljsbuild]
                     :cljsbuild    {:builds [{:source-paths ["src/zoom_recordings/ui"]
                                              :jar          true
                                              :figwheel     false
                                              :compiler     {:optimizations  :advanced
                                                             :main           "zoom-recordings.ui.core"
                                                             :output-wrapper true
                                                             :asset-path     "js/out"
                                                             :output-to      "target/classes/public/js/app.js"}}]}}

roberto18:11:55

the cljsbuild is not that different from dev, the only difference is that optimizations is set to :none

roberto18:11:16

and figwheel is set to true

dnolen18:11:28

@roberto you are aot'ing

dnolen18:11:41

unless you are prepared to prove that all your dependencies are AOT-safe you are in a world of trouble

roberto18:11:08

oh, I hadn’t had to to that before. Hmm, okay, I assume that goes inside the :compiler ?

dnolen18:11:29

AOT has nothing to do with ClojureScript

dnolen18:11:39

well technically it does (you can AOT CLJS)

dnolen18:11:43

but I’m referring to Clojure AOT

roberto18:11:52

I’ve set :aot :all

roberto18:11:57

it is the first entry in :uberjar

dnolen18:11:06

yeah so you have know that is going to work

dnolen18:11:10

otherwise don’t do that

roberto18:11:23

I understand now

roberto18:11:34

damn, I’m so dense today. I thought you were saying I should aot

roberto18:11:59

yeah, I’m still getting the same exception after removing aot

roberto18:11:34

it confuses me that I don’t get this during dev. Will keep digging.

henryw37418:11:31

I’d like to port some formatting code from clojure to cljs. There is one case so far I don’t have an answer for (clojure.core/format "$%,.2f” n) … ie I’m printing a dollar amount with commas, for example $123,123,123.34 goog.string/format doesn’t do commas apparently. I’ve had a little look at cljs.pprint/cli-format which still holds promise… although it’s new to me and a little tinkering has failed to get what I’m after. I’m sure I can get there via a custom fn… but if anyone knows of a lib, or way to use cli-format etc to do this, please let me know.

roberto18:11:56

okay, narrowing it down. The exception is only thrown when I enable advanced optimizations.

rburns18:11:09

is it possible to watch more than one directory using cljs.build.api/watch?

dnolen18:11:18

@rburns: yep cljs.build.api/inputs

martinklepsch18:11:40

what are people’s favorite visualization/charting libs? kinda growing frustrated with dimple, considering vega now...

sooheon19:11:30

@jaen: Looking at saapas, the websockets it uses seems to prevent cljs-repl from working with an nrepl-connection (i.e. using cider, connecting to the nrepl created by boot and then running (cljs-start)). Have you come across this problem? Or how do you get a cljs repl when working with it?

martinklepsch20:11:23

@mrb welcome mister pizza book! 👋

thheller20:11:12

@roberto I had this problem some time ago, it was caused by conflicting dependencies. check lein deps :tree for multipe versions of guava

roberto20:11:31

yeah, I’ve narrowed it down to BoneCp

roberto20:11:43

using a conflicting version of google guava

roberto20:11:48

switching to Hikari

jfntn21:11:03

When testing cljs, is there a simple way to start and stop a clj server like you’d do in a :once fixture in clj?

jaen22:11:58

@sooheon: sorry, Slack was down for ma and I've only now see your question. I don't know about using boot-cljs-repl with Emacs unfortunately, I only ever used it with Cursive and haven't had any problems. You basically just add the cljs-repl task in your pipeline (it has to be before the cljs task) and then you can call the start-repl function in your Clojure REPL to establish the connection. I'm not 100% sure how exactly saapas does it, since I usually set up my projects by hand, but from what I glanced at it, I do it in an analogous way.

jaen22:11:38

(br/reload :on-jsload 'presentation.frontend.core/app-reload!)
    (bcr/cljs-repl)
    (bc/cljs :source-map true
             :optimizations :none
             :ids #{"public/assets/javascripts/application"})
in my dev pipeline, and then
(defn cljs-repl! []
  (bcr/start-repl))
I call that starts the REPL.

bensu23:11:09

@jfntn: look at https://github.com/bensu/doo/wiki/End-to-end-testing-example for starting a server while cljs testing, we'll probably find a better solution in the future

bensu23:11:23

@jaen @sooheon boot-cljs-repl starts an nREPL server. Once it has started it displays something like nREPL started at localhost:PORTNUMBER. In emacs you do M+x cider-connect -> localhost -> PORTNUMBER and get a great experience

jfntn23:11:13

@bensu: perfect thanks, I’m actually using doo but somehow missed the wiki

bensu23:11:23

the wiki was created yesterday simple_smile

bensu23:11:55

but there is a lot of boilerplate in that example that I'm hoping to extract in the future

bensu23:11:15

I just need to write those tests and get a feel problem before I do

bensu23:11:08

@jfntn: also, I just pushed 0.1.6-rc.1 to clojars if you want to try it (final release coming soon)

thheller23:11:01

can someone familiar with cljs.test tell me if there is a way to determine/hook into when all tests have finished executing? asssuming there are async tests involved.

jfntn23:11:32

@bensu: great, I think the boilerplate is fine for now, I’d rather have the opportunity to configure everything I need rather than a pretty one-liner thta I need to hack around at some point 😉

thheller23:11:41

@bensu perfect, thanks

jfntn23:11:32

Do you get any kind on reporting this way though?

bensu23:11:37

yeah, I was thinking something more extensive than a one-liner but I see what you mean

bensu23:11:49

I haven't tried it yet.

bensu23:11:01

it was written by Kimmo Koskinen, @viesti

jfntn23:11:32

ok well I’ll report back then

bensu23:11:05

thanks, feel free to edit the wiki

jaredly23:11:23

how do I get a jar download url from clojars? Trying to get quil, but the page is unhelpful for this use case https://clojars.org/quil