Fork me on GitHub
#clojurescript
<
2017-03-01
>
qqq06:03:10

https://github.com/gfredericks/exact <-- is this the library to use for bigInt in cljs ?

kurt-o-sys11:03:21

Hey all... I'm trying out a boot cljs project using https://github.com/martinklepsch/tenzing 1. boot -d seancorfield/boot-new new -t tenzing -n test-project -a +rum -a +garden -a +test -a +dirac - ok 2. cd test-project - ok ๐Ÿ™‚ 3. start dev:

$ boot dev
Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.7.0
Writing boot_cljs_repl.cljs...
Starting reload server on 
Writing adzerk/boot_reload/init1547.cljs to connect to ...
2017-03-01 12:35:33.814:INFO::clojure-agent-send-off-pool-0: Logging initialized @8360ms
2017-03-01 12:35:33.862:INFO:oejs.Server:clojure-agent-send-off-pool-0: jetty-9.2.10.v20150310
2017-03-01 12:35:33.885:INFO:oejs.ServerConnector:clojure-agent-send-off-pool-0: Started ServerConnector@787995cd{HTTP/1.1}{0.0.0.0:3000}
2017-03-01 12:35:33.886:INFO:oejs.Server:clojure-agent-send-off-pool-0: Started @8431ms
Started Jetty on 

Starting file watcher (CTRL-C to quit)...

nREPL server started on port 46404 on host 127.0.0.1 - 
Adding :require adzerk.boot-cljs-repl to app.cljs.edn...
Adding :preloads dirac.runtime.preload to app.cljs.edn...
nREPL server started on port 8230 on host 127.0.0.1 - 
Adding :require adzerk.boot-reload.init1547 to app.cljs.edn...
Compiling ClojureScript...
โ€ข js/app.js

Dirac Agent v1.1.3
Connected to nREPL server at .
Agent is accepting connections at .
Compiling garden.css...
Wrote: [...]/css/garden.css
Elapsed time: 23.257 sec
- ok , but 2 nrepl server started (46404 en 8230)? And what about that clojure version conflict? - Why is it looking for clojure 1.7.0?
$ cat boot.properties 
#
#Wed Mar 01 12:17:21 CET 2017
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.8.0
BOOT_VERSION=2.7.1
BOOT_EMIT_TARGET=no
4. connect to nrepl:
$ boot repl --client
Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.7.0
Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.7.0
Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.7.0
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_92-b15
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from : [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (start-repl)

boot.user=> java.lang.IllegalStateException: Can't change/establish root binding of: *cljs-repl-env* with set


boot.user=> 

boot.user=> (.log js/console "test")

             java.lang.RuntimeException: No such namespace: js
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such namespace: js, compiling:(/tmp/boot.user1255255195879186583.clj:1:1)
boot.user=> (quit)
Bye for now!
- nope... What am I doing wrong here? (And there's that clojure version conflict again?)

kurt-o-sys11:03:59

- I hope I got the right channel, or should I put it on #boot ?

darwin11:03:09

@kurt-o-sys why donโ€™t you start first by not including +dirac and +test? and then add them one by one until it breaks

darwin11:03:32

I cannot really help here, but you should be able to isolate the issue more precisely

kurt-o-sys11:03:42

sounds like a plan

darwin11:03:29

also I briefly checked the template code and it looks like the dirac version is hard-coded here: https://github.com/martinklepsch/tenzing/blob/master/src/leiningen/new/tenzing.clj#L108 this could be another source of very sharp edges, v1.1.3 is about a month old and running it against latest canary could cause hard-to-understand compatibility issues, you should be always running latest dirac with latest canary or stick to particular versions: https://github.com/binaryage/dirac/blob/master/docs/faq.md#why-should-i-use-recent-chrome-canary-with-dirac-devtools

kurt-o-sys11:03:49

ok, nrepl works if dirac is not added... The Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.7.0 is still there

martinklepsch12:03:11

@kurt-o-sys you can probably use boot show --pedantic to track down that conflict

kurt-o-sys12:03:42

let me try:

$ boot show --pedantic
Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.7.0
Retrieving[...]
[!] com.google.guava/guava
    โœ” 19.0
      org.clojure/clojurescript
    โœ˜ 18.0
      weasel
      com.cemerick/piggieback
[!] com.google.javascript/closure-compiler
    โœ˜ v20150505
      weasel
    โœ˜ v20150126
      com.cemerick/piggieback
[!] com.google.javascript/closure-compiler-externs
    โœ” v20160911
      org.clojure/clojurescript
    โœ˜ v20150505
      weasel
    โœ˜ v20150126
      com.cemerick/piggieback
[!] org.clojure/clojure
    โœ˜ 1.8.0
      rum
      org.clojure/clojurescript
    โœ˜ 1.7.0-RC1
      weasel
    โœ” 1.7.0
      pandeiro/boot-http
    โœ˜ 1.6.0
      com.cemerick/piggieback
    โœ˜ 1.2.0
      org.clojure/tools.nrepl
[โœ”] org.clojure/clojurescript
    โœ” 1.9.293
      org.clojure/clojurescript
    โœ˜ 0.0-3308
      weasel
    โœ˜ 0.0-3165
      com.cemerick/piggieback
[!] org.clojure/google-closure-library
    โœ” 0.0-20160609-f42b4a24
      org.clojure/clojurescript
    โœ˜ 0.0-20150505-021ed5b3
      weasel
    โœ˜ 0.0-20140718-946a7d39
      com.cemerick/piggieback
[!] org.clojure/google-closure-library-third-party
    โœ” 0.0-20160609-f42b4a24
      org.clojure/clojurescript
    โœ˜ 0.0-20150505-021ed5b3
      weasel
    โœ˜ 0.0-20140718-946a7d39
      com.cemerick/piggieback
[!] org.clojure/tools.reader
    โœ” 1.0.0-beta3
      org.clojure/clojurescript
    โœ˜ 0.9.2
      weasel
    โœ˜ 0.8.16
      com.cemerick/piggieback
right... so it's taking the clojure version from boot-http ?

kurt-o-sys12:03:40

well... easiest way to solve it seems to be to add :exclusions ['org.clojure/clojure] to set-env!

martinklepsch12:03:10

@kurt-o-sys I think you should probably just add [org.clojure/clojure โ€œ1.8.0โ€] to your list of dependencies

martinklepsch12:03:41

maybe thats something that should be fixed in tenzing, I surprisingly havenโ€™t noticed this issue myself though

kurt-o-sys12:03:10

ok... let's try that one ๐Ÿ™‚

kurt-o-sys12:03:27

yeah, seems to be ok as well

martinklepsch12:03:00

welcome ๐Ÿ™‚

jaymartin12:03:48

Our open source learning group is hosting the free online webinar Essential Klipse this Saturday at 7 pm UTC. ClojureScript fundamentals will also be discussed. Everyone is welcome! http://discuss.thevalueoflearning.org/t/webinar-discussion-2-essential-klipse/39?u=jay

shaun-mahood15:03:40

@martinklepsch: Any chance you have some time for some questions about OpenLayers and the cljsjs package for it? I'm trying to get it working with CLJS and I think I'm missing something fundamental in my understanding of how the GClosure files and externs interact.

martinklepsch16:03:02

@shaun-mahood can try to help but never used it myself. Either way letโ€™s take this to #cljsjs

piotr-yuxuan19:03:36

Hi there ๐Ÿ™‚ Just a quick question Iโ€™m not sure about: letโ€™s say we have ns example.stuff.utils from project example. Which are available locations for the file declaring this ns? src-root/example/stuff/utils.cljs, src-root/example/stuff.utils.cljs, anywhere you want under the source root directory? is there any difference between clj and cljs on this point?

devth19:03:49

used to have to conditionally require clojure.pprint and cljs.pprint for cljs/clj in a .cljc file but now i can apparently just require clojure.pprint. 1. is that a trend that will continue? e.g. will I be able to do the same for cljs.spec? 2. why do they differ โ€“ is it because there are slight differences in how they work?

jr19:03:46

cljs compiler aliases clojure. namespaces to cljs.

devth19:03:04

oh, so i can do it with everything already

benzap19:03:08

Anyone have a good workflow for writing tests with cljs.spec? I'm trying to incorporate some macros for conformance, but I keep getting a ton of warning and errors

benzap19:03:48

I'll post what I have, maybe i'm missing something simple

piotr-yuxuan19:03:07

Hello @benzap ๐Ÿ™‚ Just as a notice, you might be willing to as this in #clojure-spec

benzap19:03:43

I would, but i'm not sure if the problem is with spec, or just clojurescript not liking my macros

benzap19:03:17

if I make a function 'is-conformed' within the same file as slider.cljs, it works fine

benzap19:03:47

if I put it in a separate file, it doesn't work. I think i'm misunderstanding how macros are generated in clojurescript

benzap19:03:33

sorry, I mean it doesn't matter if it's a macro or a function. I'll try a few more things, maybe i'm just brainfarting on something simple

benzap19:03:08

so functions work, but the test doesn't show what's being tested. I want to use a macro so the body of the cljs.test/is macro is caught and displayed in the test output

benzap19:03:20

so upon failure I can have a better idea of what test failed

benzap19:03:58

However, when I use the macro listed up top, I get Use of undeclared Var fluch.devtests.slider/spec which refers to the spec parameter in is-conformed

benzap20:03:06

Alright, so I brought it down to the smallest error case

jr20:03:32

is that a single quote in test-macro or a syntax quote?

benzap20:03:45

single quote

jr20:03:02

x is not splicing there

benzap20:03:02

haha thanks

benzap20:03:10

I think that might be it

benzap20:03:19

i've spent 2 hrs on this!

jr20:03:30

macros are hard ๐Ÿ™‚

benzap20:03:29

Thanks a lot for the help, it's working perfectly

grav21:03:18

How do I get the env from node-js? environ doesnโ€™t seem to support cljs

grav21:03:13

Thanks! Wouldnโ€™t it make sense to make environ wrap it?

bostonaholic21:03:03

Iโ€™m sure PRs are welcome ๐Ÿ˜œ

grav21:03:07

๐Ÿ™‚

grav21:03:17

Before I get started, does it at all make sense?

bostonaholic21:03:21

lots of libs could benefit from porting to cljc

bostonaholic21:03:08

I donโ€™t know about environ specifically, but you could probably open an issue and start the conversation with the maintainer

bostonaholic21:03:49

there might be some sharp edges to watch out for the the maintainer can help you deflect

andrea.crotti21:03:30

using figwheel and garden, is it possible to have them both running with the same command?

andrea.crotti21:03:46

at the moment I call figwheel from cider

andrea.crotti21:03:54

but then launch lein garden separately

andrea.crotti21:03:13

not the end of the world really but I guess there might be anotherway

andrea.crotti21:03:20

also is there anything to see the test coverage of clojurescript code?

brenden23:03:56

@grav if you make a macro that wraps environ you can call it from cljs

darwin23:03:55

why to do or dynamically on each call, when you know (env kw) is a compile-time constant, you should do something like this IMO: https://gist.github.com/darwin/e64eeae5f4b698f559fc722b6860f612

brenden23:03:40

thanks, i'll do that instead