This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-03
Channels
- # beginners (111)
- # boot (1)
- # braveandtrue (4)
- # calva (2)
- # cider (16)
- # clara (35)
- # cljdoc (4)
- # cljs-dev (22)
- # clojure (80)
- # clojure-dev (17)
- # clojure-europe (3)
- # clojure-italy (57)
- # clojure-japan (1)
- # clojure-nl (4)
- # clojure-serbia (1)
- # clojure-spec (25)
- # clojure-uk (108)
- # clojurescript (67)
- # cursive (17)
- # data-science (5)
- # datascript (6)
- # datomic (6)
- # devcards (1)
- # events (1)
- # expound (13)
- # figwheel (2)
- # figwheel-main (6)
- # fulcro (7)
- # jobs-discuss (8)
- # kaocha (1)
- # luminus (3)
- # nrepl (6)
- # off-topic (58)
- # re-frame (1)
- # reitit (16)
- # remote-jobs (1)
- # ring (1)
- # shadow-cljs (70)
- # spacemacs (10)
- # sql (42)
- # testing (1)
- # tools-deps (8)
- # vim (1)
what is the idiomatic way to create custom eventypes/dispatcher in clojurescript ? I follow this pattern https://stackoverflow.com/questions/9088165/creating-events-with-google-closure but i sense there is place for deftype/protocol/reify here, althought i do not grasp the conspects clear
There's this, but I don't think people use it very much https://github.com/clojure/clojurescript/blob/master/src/main/cljs/clojure/browser/event.cljs
Hey guys, fairly new to clojure(script), did use it 2-3 years ago for a spell so not entirely a beginner. Just wondering about the up-to-date conventions in 2019 that people are using to build web apps?
hey, I think http://book.fulcrologic.com/ + shadow-cljs is the way to go nowadays. It works amazingly well for us
Hi all 👋 . Looking for some prior art: Has anyone built a CLI with subcommands (e.g. like you would with commander) in cljs? My use case is building something like this and then packaging with nexe for static binary deployment to macOS/Linux/Windows.
Hi @damienstanton We're soon about to start a project to build a CLI with subcommands. We have built a quick proof-of-concept and done some initial technical design. We built the proof-of-concept with tools.cli, Chalk, Inquirer and shadow-cljs and planning to use that stack for the real thing
anybody aware of a good "walkthrough" of clojurescripts dependence on goog
? recently my production build started crashing on page load due to `Uncaught ReferenceError: goog is not defined
at app.js:1`
hm. does it have anything to do with :optimizations
? i set them back to :none
on the production build in order to see error messages, but the error persists with :advanced
as well
well, that got rid of the goog
error. build still broken though, for whatever weird reason the deployed cljsbuild has decided to start having a problem with a specific library, despite there not being any version updates to that or the build itself lately
Wow, this must be the weirdest issue I've had. Some old library starting generating errors in the production build. Nothing I did got rid of it - not updating it's version, or other dependencies, or the build tools, compiler settings, nothing. In the end I had to get rid of it and just rewrite that portion of the code without using that library
Wasn't an obscure library either, https://clojars.org/mount
Is anyone using figmain integrated with cursive? I folowed the instructions here: https://github.com/bhauman/figwheel-main/blob/master/docs/docs/cursive.md But see this when the repl starts:
May 03, 2019 1:59:46 PM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
Unable to detect a system Terminal, you must not launch the Rebel readline
from an intermediate process.
If you are using `lein` you may need to use `lein trampoline`."
Is this normal?@steven.katz It might be worth trying setting the REPL to be of clojure.main
type instead of nREPL
(assuming you have it at the nREPL
default)
thats what I am chosing
If I choose nREPL it does not work at all (wont take input)
I’ve been surprised by the behavior of doing an clojure.core/eval
at macroexpansion-time in cljs. I made a small gist example to demonstrate.
I’m curious if anyone could enlighten me to what is happening? I’m guessing that def
s are not actually updating the state of the CLJ-ns that the macros are being expanded in.
Is there any safe way to do an “eval” sort of op during macroexpansion in CLJS? In the example I just have a symbol, but I’m curious about arbitrary types of forms that have symbols to resolve as well.
https://gist.github.com/mrrodriguez/dc48281196f99e30ee84c56c0ec6f63a#file-foo-cljs
@dnolen sure, I know it’s a stretch, but was curious if there are anyways to try to “do things” during macroexpansion that may involve eval-like behavior
and I was at least a little surprised that the clj ns doesn’t have any def
into it, I guess that is just all managed via the cljs compilation state instead
it’s like if I want a macro to use in cljs, and the macro receives a symbol - I want to resolve it, do something with it during expansion prior to emitting the forms from the macro
if it’s “just symbols” I guess I can just use some symbol resolve stuff from the cljs.analyzer
Yeah, this eval
thing seems to have magically worked out in some cases I had before - I thought it looked like a bad idea, but then couldn’t figure out how it ever worked. I tried to simplify it down and it seems like it shouldn’t work
Hi! In Clojure I rely on namespaced keywords a lot and in some cases use plain JSON for serialization. cheshire handles this well both ways. In clojurescript the ingress path works well (js->clj (.parse js/JSON some-string) :keywordize-keys true)
has the same behavior
For egress, clj->js
removes namespace info (since the output is a JS object it makes sense)
is there a way to go directly to JSON and preserve that info or will I be forced to pull in transit?
cljs.user=> (defn transform-keys
#_=> [m key-fn]
#_=> (walk/postwalk (fn [item]
#_=> (if (map? item)
#_=> (zipmap (mapv key-fn (keys item)) (vals item))
#_=> item))
#_=> m))
#'cljs.user/transform-keys
cljs.user=> (transform-keys {::foo 1} name)
{"foo" 1}
cljs.user=> (transform-keys {::foo 1} str)
{":cljs.user/foo" 1}
@pyr Transforming all of these keys to strings first allows them to go to JSON without a hitch. You'll then just need to transform them back on the way in, using (transform-keys data keyword)
.
With CLJS 1.10.439
, I should be able to add a dep like :npm-deps {"@sentry/browser" "5.1.0"}
, use :install-deps true
, add :infer-externs true
, and require the dep like (ns foo.bar (:require ["@sentry/browser"]))
, right?
This all compiles, but I see Undefined nameToPath for module$home$jeaye$projects$foo$node_modules$$sentry$browser$node_modules$$sentry$core$esm$integrations
when executing.