This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-09
Channels
- # aleph (4)
- # beginners (31)
- # boot (33)
- # cider (7)
- # cljs-dev (263)
- # cljsrn (1)
- # clojure (33)
- # clojure-austin (2)
- # clojure-dev (1)
- # clojure-russia (6)
- # clojure-spec (19)
- # clojure-uk (7)
- # clojurescript (79)
- # cursive (21)
- # datascript (1)
- # datomic (13)
- # dirac (12)
- # emacs (15)
- # hoplon (26)
- # lein-figwheel (3)
- # leiningen (1)
- # luminus (5)
- # lumo (20)
- # mount (1)
- # off-topic (17)
- # om (13)
- # onyx (24)
- # parinfer (70)
- # pedestal (2)
- # re-frame (19)
- # reagent (1)
- # ring-swagger (3)
- # unrepl (8)
- # untangled (58)
- # yada (2)
is there some standard integration between lein-cljsbuild and cljs.test?
the cljsbuild example file only shows how to run an arbitrary shell command
my setup here does not work so well with newer versions of cljs, and I'd like to declare bankruptcy if things have changed sufficiently in the last year https://github.com/gfredericks/exact/blob/3f46ef96eaa26128897d55f83da8274e25b5e0db/project.clj#L15
I think I figured it out
Hey everyone, I’m sure this has been asked a billion times, but as an experienced JavaScript react dev, what is the best way to learn cljs? Closure resources or are there others?
jhorwitz: i found clojure koans useful http://clojurekoans.com/
the hoplon get started page is also useful 🙂 https://github.com/hoplon/hoplon/wiki/Get-Started
if you’re already doing redux you should “get” cljs pretty quickly, except that it’s, you know, better 😉
i work with react in my day job and cljs in my own product, so if you have any questions i might be able to help 🙂
How would I integrate clojurescript-based react native into an existing android app?
Hi, Is there any way or a plugin. So that network requests with edn are displayed nicely as maps in chrome devtools?
Does anyone know how to include the figwheel client js code into a single file build? Seemed like simply setting the :optimizations to :simple does not do the job
@iku000888 Figwheel will disable itself if optimizations
is something else than :none
because reloading files is not possible with other options
@juhoteperi Thanks! I was suspecting that is the case. Got curious because I had a constraint where even during dev time the output js had to be a single file.
I am guessing the best I could go is something like weasel + a watch build in that case?
@lxsameer I tend to set them in :external-config
in compiler options and then use a macro to read them into clojure (to be used by macros) and then optionally emit them into generated cljs code to be consumed there
for libraries I additionally allow overriding them via environmental variables, for people who don’t want or cannot change project settings (verisoned under git)
@darwin Awessome. that would be a really nice feature for people moving from js to clojurescript 🙂
@lxsameer in case of a library, if you use :external-config
make sure to pick unique enough key for your config, ideally namespaced
this is a really random question, but can someone point me to a thing in clojure that implements the ISwap
interface? I was looking into how Atom
works, which is pretty straightforward… https://github.com/clojure/clojurescript/blob/b7a1b1a75de24734026a34dd0e93ba02e2b076c8/src/main/cljs/cljs/core.cljs#L4365-L4373 but at some point the swap!
function invokes -swap!
if the given argument is not of type atom
. I cannot find anywhere in the codebase where a concrete thing implements ISwap except for this https://github.com/clojure/clojurescript/blob/0aed47861b025eb1b3757a77c7ec425682d01354/src/main/clojure/cljs/core.cljc which I don’t fully understand, but it doesn’t look related (some dynamic defining of a protocol lookup map, maybe?).
It does seem to complain properly that no protocol method -swap! defined for cljs.core/{some non-atom type}
, but then that begs the question why is it there in the first place?
@lwhorton I have no definitive answer, but it may just be an extension point so people can provide their own types that work with swap!
@lwhorton clojure design philosophy dictates never defining a method that isn't on an abstract interface https://clojure.org/reference/datatypes#_datatypes_and_protocols_are_opinionated
Meanwhile, I want my *.cache.json files, but with :optimizations :simple, I don't see them. Are they produced and deleted, or just never produced? How can I ask to keep them?
if you didn'thave ISwap, you would need to inherit from Atom, and clojure doesn't do that kind of thing
Ah I see.. that’s a good reference @noisesmith . So if someone wanted to implement their own behavior on non-atom swap!
s, they must have a type / record that implements -swap!
, and ISwap
is that interface to implement. Otherwise, as you said, you would have to do some sort of inheritance from deftype Atom
where you attach/override another method etc., and “clojure don’t play like that”
yeah, that's it
it's a little different in clojurescript since inheritance is different in js, but the basic principles hold
‘tis amazing how many of these things i’ve read and reread, but never really understood
...and now that I've actually articulated my question, the answer is easy to find: :cache-analysis true
Hey, I’m trying to compile a clojurescript node app using this config:
(cljs.build.api/build
"src"
{:optimizations :none
:main 'cri.core
:npm-deps {:chrome-remote-interface "0.24.1"}
:closure-warnings {:non-standard-jsdoc :off
:common-js-module-load :off
:violated-module-dep :off}
:language-in "ecmascript-next"
:compiler-stats true
:parallel-build true
:target :nodejs
:verbose true
:output-dir "target"
:output-to "target/main.js"})
But keep getting this error:
clojure.lang.ExceptionInfo: No such namespace: chrome-remote-interface, could not locate chrome_remote_interface.cljs, chrome_remote_interface.cljc, or Closure namespace "chrome-remote-interface" in file src/link_archiver/core.cljs
well that’s probably because Closure failed to consume your chrome-remote-interface
dep
and you might be swallowing the errors it throws 😞
anyway, if you’re compiling for Node.js, why not just (js/require "chrome-remote-interface")
?
it does get processed with compiler though. I can see it in target/node_modules/chrome-remote-interface
and index.js
has some goog.provide
shenanigans
trying to repro
I can repro, but not gonna spend any time figuring it out
^ we’re dropping support for :npm-deps
with :target :nodejs
in the next release of ClojureScript
it’s only meant to be used for the browser
Node.js has its own facilities for consuming modules
@skammer btw I figured out the problem anyway
the chrome-remote-interface
module doesn’t have a "main"
entry in its package.json
which I guess might have uncovered a problem in ClojureScript
but I need to look closer
@skammer I also couldn’t get it to repro without adding entries for
{:utf-8-validate "3.0.3"
:bufferutil "3.0.2"}
not sure if expected
yep, I had to add them as well. I guess it kept compiling while after I removed those from :npm-deps
because I already had them in node_modules
or something
would be nice to default :language-in
to at least :es-6
, as some npm modules are using it already
not neccessary but maybe easier - clojurescript has more odd details you need to remember
the tooling for cljs is a bit weirder though, and the clojure tooling is a prerequisite in most cases
that is, most people won't get a good cljs env set up without getting a good clj env first
(self hosting like lumo or planck changes this of course, but I don't think it's as common as using clojurescript.jar via leiningen or boot)
@skammer thanks for bringing this up though, there’s definitely a ClojureScript bug here 🙂