This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-21
Channels
- # announcements (3)
- # aws (8)
- # babashka (14)
- # beginners (39)
- # biff (22)
- # cider (5)
- # clj-kondo (1)
- # cljs-dev (12)
- # cljsjs (4)
- # clojure (16)
- # clojure-europe (47)
- # clojure-germany (6)
- # clojure-uk (2)
- # clojurescript (36)
- # core-async (29)
- # cursive (19)
- # datalevin (14)
- # etaoin (10)
- # helix (1)
- # hyperfiddle (6)
- # introduce-yourself (5)
- # kaocha (43)
- # keechma (1)
- # lsp (7)
- # nbb (68)
- # new-channels (1)
- # off-topic (12)
- # pathom (11)
- # quil (14)
- # rdf (3)
- # re-frame (5)
- # reitit (6)
- # shadow-cljs (88)
Hi, I've been using clojurescript + shadow-cljs for a while and lately I bumped into a few issues related to macros + clojure dependencies. For my clojure projects, I use integrant to manage system components and this is actually very handy to describe the whole system. When I'm working on a project in dev mode, I load the dev configuration and all details are managed directly. But when I'm working with clojurescript (shadow-cljs + clojure deps), I don't have the same abilities and I'd like to address this. How do you manage your profiles (dev, test, prod) with the current ecosystem? Does something relying on integrant exist? I would like to avoid playing with classpath and same filenames to handle this.
could you be more specific on what specific problem you are trying to solve? I mean you can use integrant in CLJS? but what is the particular issue?
for instance, I want to describe several system components with specific urls and connection details and I have different configurations depending on the loaded profile (dev, test or prod)
My main issue was related to the fact that integrant is designed for programs using clojure. I don't think I can use integrant to actually load a configuration at the clojurescript level. If I want to describe a foreign api with a specific url for dev and another for test, I can but I won't be able to access these profiles from clojurescript without going through a macro. I may be wrong here…
well, yes the way you get access to a config file is different but you can just load if via xhr or something
so move it to runtime and either get the config via xhr or out of your html or something
ok, I thought there was something else behind that would prevent this. But if it's just the way config files are accessed, I can try something. Thank you, I'm going to experiment
if it's an option for you, you can "inline" all 3 configs files in your source files and select the correct one using closure define. It's not really "config" anymore though
fyi if you're looking for integrant-like that works in javascript (ie most likely need async components), https://github.com/juxt/clip is what I use.
Thanks, I'll take a look at it. Right now, I use macros to select the right profile and inline it for integrant to read it on client side
This is a light survey question. Do you use Yarn or something similar but more then NPM? If so, why or why not?
Trivial question ... is there a more idiomatic way of converting a string into a ClojureScript boolean?
(let [env-defaults {:DEBUG "true"}]
; env vars are always strings
(.valueOf (js/Boolean. (get env-defaults :DEBUG false))))
yeah, true that could work but I would rather be stricter and use a boolean the way the good lawd intended
@raymcdermott there's a new function called parse-boolean
if you can use a more recent Clojurescript
after playing with it I notice that parse-boolean
blows up if it gets nil or a boolean. So in the above case I have to change the default to "false".
I mean using the ctor will make a thing which is not the primitive boolean and won't compare correctly like Java
.valueOf
does exactly that ... returns the primitive value - that's how I made it work
and I guess false
is OK cos you just pass that value straight through to JS ie no interop needed
I see from your original example why you seem to care about nil
and false
cases because of your use of get
and get
default value