This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-12
Channels
- # admin-announcements (11)
- # alda (1)
- # boot (186)
- # cider (17)
- # clojure (96)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-russia (2)
- # clojurescript (132)
- # core-async (1)
- # datomic (16)
- # devcards (9)
- # editors (2)
- # emacs (4)
- # funcool (2)
- # hoplon (125)
- # ldnclj (30)
- # leiningen (13)
- # off-topic (6)
- # onyx (2)
- # reagent (5)
- # spacemacs (21)
- # yada (3)
@freyert: check out cljsjs, http://cljsjs.github.io/
the answer looks to be yes
@alandipert: looovely!
@alandipert: I was able to add it as a dependency and it downloaded, but I can't seem to require it in the actual application.
what does your ns
look like?
"The jar only provides an extern file required for advanced compilation. The Google Maps js API will still need to provided through some other mechanism."
https://github.com/hoplon/google-maps looks like an example
it doesn't appear to be hoplon specific... uses another library to load the google maps js on page load
I suppose my question now is, if I have the extern, do I need to add this to foreign dependencies?
Yeah, it's still a bit unclear what I do now, that I have the CLJSJS jar
for googlemaps. How do I interact with it to add the path to the javascript?
you can do it, i believe in you 😃
I'm just so used to doing this the NodeJS way. There I would expect my dependency management system to install the dependencies locally . . . But munging a local dependency would not work well in deployments . . . so I'm assuming I just need to throw these values into :foreigndeps
@freyert: the cljs task takes options that it passes to cljsc
but yeah, the level of ceremony is intense
also hoplon would be something to experiment... at least, if you need to move fast
we made a framework in an effort to alleviate shenanigans such as these
Oh yeah, I'm trying out hoplon at the moment to try and get a hang of this. It's pretty clear I don't know up from down at the moment though haha
deraen: i did a custom build of react 0.13.3 with addons and the tap-event-plugin (which requires a custom browserify build) - seems like it would be a useful addition to cljsjs, but i'm not sure where to add it - i've currently just bastardised the react-with-addons package, but clearly that's not mergeable to cljsjs/packages - do you have any thoughts about what would be best ?
oops - should have been a pm - sorry
@freyert: the reason google maps is not packaged in cljsjs is that to use it you need to get it from google with an API key with something like <script src='goog/cdn/maps?API=123123123'>
follow Google Maps' Quick Start from ClojureScript and when it's time to do advanced compilation use cljsjs
's externs.
@mccraigmccraig: packaging it as a separate package would be the best option I guess, don’t know if that would be possible though.
@martinklepsch: i can do it as a separate package easily enough... i'm not sure if that will work with things requiring react though - what's the reason cljsjs/react-with-addons is in the same package as cljsjs/react ?
@mccraigmccraig: that’s just a technicality because they’re so close and because reacts packaging is broken in a way that they can’t ship addons as a separate file
@mccraigmccraig: you can make your package depend on cljsjs/react-with-addons and then react with addons will be included in the build
@martinklepsch: no, i can't do that - react's packaging is broken in such a way that if you want to use the tap-event-plugin you have to create an entirely new custom build of react - with addons if you want them too !
oh ok, then I misunderstood and it won’t work 😉
martinklepsch: is there any reason why a separate project react-with-addons-and-tap-event-plugin wouldn't work ? i currently just exclude cljsjs/react from my reagent dependency and add a cljsjs/react-with-addons dependency...
glorious indeed
no that could work and seems to be the only option really
just would have been nicer to have it as separate package
by separate package you mean a package which didn't also include the main react js ?
@mccraigmccraig: yeah, similar to how react-with-addons is packaged I guess
@mccraigmccraig: the problem with making a new package is that it completely breaks transitive dependencies
imagine if in clojure we had http-kit-with-ring-and-compojure and http-kit-with-ring-and-noir packages
@micha: do you see another option ?
@micha: any realistic option ? react is packaged with browserify from npm packages... there's no way afaics of exposing the internals of that to cljsjs / maven
react packaging is borked, definitely good to speak up where appropriate, e.g here https://github.com/facebook/react/issues/680
@martinklepsch: that's already done - npm has separate packages for each of the addons as of 0.14 - so maybe there is hope
but the tap-event-plugin still requires a custom build of react
which apparently won't be fixed until 1.0
@micha: that may be possible for 0.14 - i'm still stuck on 0.13.3 though, since reagent isn't happy with 0.14 yet
but even for 0.14, there's no solution other than a custom build for the tap-event-plugin
how can you build abstractions when you need to make a special build of all your dependencies and dependencies of dependencies
i wonder if facebook has something like bazel internally also
the google build system thing
that would be good motivation not to care about 3rd party packaging
why care when you never use libraries
it might be something to do with the npm packages - as i understand it (no doubt badly), npm is pretty brutal about hiding details and only exposing an explicit api to a requesting caller (and not in a global namespace as is the norm with maven / clojure / java) - this is presumably a good thing and can mitigate problems with dep-hell (i.e. multiple versions of some lib can co-exist in the same process) - but maybe it doesn't play nicely with packaging systems which assume a global namespace ?
java is not awesome at this - having multiple versions of an artefact coexisting in the same process is painful, so as any project gets large there isn't any way of saying "i don't care if these two dependencies require different incompatible versions of the same minor lib"
like maybe two things depend on different versions of some library, but at least the library has a unique name
as i understand it, with npm two things can depend on different versions of some library, both things will get the version of some-library they asked for and the two versions of some-library will not interact with each other because all their functions and state are hidden away in closures and only exported to the requestor
the version of library C that A needs defines some type Foo, where Foo has a .safeOperation() method that prints "don't panic" to the screen
and in the other version of C the Foo type has a .safeOperation() method that nukes the world
i gather you can also require only a single version of some lib to be installed in the process where necessary with peer dependencies - it's a tradeoff afaics - dependency hell in the java scheme, or avoidance of dependency hell and some other problems in npm
also the kinds of dependency hell you see in java are actually a testament to the robustness of maven
like we see some issues where pomegranate depends on some version of apache http and ring depends on jetty which depends on another one, things like that
the only way that kind of code reuse is possible is because of the strict organization of artifact ids
NPM also has dependency hell but it's mostly caused by libraries not following semver and depending on other libraries using ^
and ~
I used to think NPM is quite good but nowadays I won't use it if don't absolutely must
@micha: Clojure or Node? And why not?
and if you have another google thing, like google places or whatever that uses the google jsapi it's also fine
(okay looks like JS libraries don't depend on React)
hi all - any examples of a boot project that uses (clj) testing? I think I am being a numpty and prior art will help
@micha: npm does transitive deps just fine - take a look at a package.json in any node project. doesn't look much different from clojure deps, or gemfile deps or whatever
react however hasn't historically been very good at using the features of npm packaging ... they have now split out the addons into separate npm packages, but the tap-event-plugin still requires a custom build, which is where i started from
@colin.yates: https://github.com/adzerk-oss/boot-test/blob/master/src/adzerk/boot_test/test.clj
@alandipert: I did say I was being a numpty
@mccraigmccraig: sorry, depdendency management is like the bane of my existence
@colin.yates: there's also a midje task, and maybe other test tasks... consulting the "community tasks" page might be enlightening (i haven't checked in awhile myself)
@micha: i've not been loving it too much today either
@alandipert: I was trying to add the test directory in a deftask:
(deftask testing
"Test the clojure sources"
[]
(set-env! :source-paths #(conj % "test/clj"))
identity)
and then running boot testing tests
but that caused the project not to be built with the following error: boot testing test
clojure.lang.ExceptionInfo: java.io.FileNotFoundException: Could not locate boot/core__init.class or boot/core.clj on classpath., compiling:(backend/boot.clj:1:1)
data: {:file
"/var/folders/1j/rmvwckss5775bbky8cqgk0cc0000gn/T/boot.user3564447694034566375.clj",
:line 21}
java.util.concurrent.ExecutionException: java.io.FileNotFoundException: Could not locate boot/core__init.class or boot/core.clj on classpath., compiling:(backend/boot.clj:1:1)
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate boot/core__init.class or boot/core.clj on classpath., compiling:(backend/boot.clj:1:1)
java.io.FileNotFoundException: Could not locate boot/core__init.class or boot/core.clj on classpath.
...
clojure.core/load/fn core.clj: 5866
clojure.core/load core.clj: 5865
...
clojure.core/load-one core.clj: 5671
clojure.core/load-lib/fn core.clj: 5711
the rest of the project (which is @juhoteperi’s excellent https://github.com/Deraen/saapas project) builds fine. I added the appropriate requires and refers - most weird
hi @colin.yates did you modify the list of dependencies in another place?
also never hurts to check boot -V
hi @martinklepsch - no I literally cloned @saapas, added the boot-test dependency and the requires
how can i get org.webjars/bootstrap
's fonts directory into boot's output files so they are included in target?
@colin.yates: Could be that boot-test depends on really old Boot/core
Try adding [boot/core "2.3.0" :scope "test"]
to your project
hi @juhoteperi - no joy :
boot testing tests
clojure.lang.ExceptionInfo: No value supplied for key: (clojure.core/seq (clojure.core/concat (clojure.core/list (quote adzerk/boot-cljs)) (clojure.core/list "1.7.48-5") (clojure.core/list :scope) (clojure.core/list "test")))
data: {:file
"/var/folders/1j/rmvwckss5775bbky8cqgk0cc0000gn/T/boot.user1377485475066217225.clj",
:line 5}
java.lang.IllegalArgumentException: No value supplied for key: (clojure.core/seq (clojure.core/concat (clojure.core/list (quote adzerk/boot-cljs)) (clojure.core/list "1.7.48-5") (clojure.core/list :scope) (clojure.core/list "test")))
...
clojure.core/hash-map core.clj: 371
...
clojure.core/apply core.clj: 630
boot.pod/apply-exclusions pod.clj: 268
clojure.core/partial/fn core.clj: 2493
clojure.core/mapv/fn core.clj: 6616
@colin.yates: you could try just requiring and running your test ns from the REPL to see if it's boot-test-related issue
I see - so a boot testing repl
will get me a repl with the (set-env!) from the testing
task?
Strange, boot/core dep fixed it for me. Anyway, Saapas has now test example.
i wonder if it's because boot-test runs your tests in a pod
ah - so it really helps if you don’t have a trailing ‘`’ which is impossible to see on the end of the dependency (blush)
yeah, i think tha'ts what it is - boot.core isn't in the boot-test pod
so yes, adding boot/core
works
if i have a file foo/bar/baz
in a jar in my deps, shouldn't i be able to access that file with (
?
The org.webjars/bootstrap
jar has a file: META-INF/resources/webjars/bootstrap/3.3.2-2/fonts/glyphicons-halflings-regular.eot
Ok, well, the thing is that (io/resource ...)
returns a url, not a file... you can slurp it, but it's not a file
I think that even when you get past the path issue (I guess you have an issue with the path that you are using to get to the file), it will help you to know that (.isFile ...)
won't return true
I am not able to access any of the files in that jar, even though boot-less
is accessing it fine
@pandeiro: What are you tring to do? You can access files in classpath using io/file
And you can't make file out of URL (resource)
but you can read contents of an URL using input-stream/reader/slurp
@juhoteperi: I need to output the .../fonts/...
stuff from the bootstrap jar into target for packaging with static assets
(sorry for typos)
Just use io/resource
In boot less do you have to do something to get the webjars stuff before accessing it?
Somehow I am including org.webjars/bootstrap "3.3.5"
but the only thing in my ~/.m2/repository
was 3.3.2-2
I want to add boot projects support to http://jarkeeper.com/. Any tips how I can easily parse build.boot
file and extract dependencies?
@juhoteperi: would there be any way I could "search for" eg a .ttf
file that was in a webjars jar? I can't get it with by-ext
, right?
@pandeiro: If you are accessing classpath it's not very easy, you need to go through all JARs in the classpath and check their contents:https://github.com/Deraen/less4clj/blob/master/src/less4clj/webjars.clj#L11
But alternatively you could import some files from specfic JAR to fileset using sift
and then you can use by-ext
@pandeiro: sift :add-jar