This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-22
Channels
- # adventofcode (12)
- # announcements (17)
- # babashka (46)
- # beginners (105)
- # calva (7)
- # chlorine-clover (7)
- # cider (9)
- # clj-kondo (41)
- # cljsrn (16)
- # clojure (67)
- # clojure-australia (1)
- # clojure-europe (24)
- # clojure-france (6)
- # clojure-germany (10)
- # clojure-italy (1)
- # clojure-losangeles (3)
- # clojure-nl (4)
- # clojure-uk (11)
- # clojurescript (8)
- # cursive (8)
- # data-oriented-programming (1)
- # data-science (1)
- # datomic (11)
- # defnpodcast (4)
- # events (1)
- # fulcro (34)
- # graalvm (6)
- # helix (3)
- # jackdaw (19)
- # jobs-discuss (1)
- # leiningen (9)
- # luminus (2)
- # malli (15)
- # mathematics (2)
- # meander (5)
- # mental-health (1)
- # off-topic (4)
- # pathom (23)
- # podcasts-discuss (1)
- # polylith (4)
- # quil (3)
- # re-frame (81)
- # react (1)
- # reagent (19)
- # reitit (4)
- # releases (1)
- # reveal (11)
- # shadow-cljs (54)
- # specter (14)
- # tools-deps (16)
- # vscode (2)
- # xtdb (3)
What's the correct workflow when adding a dependency to shadow-cljs.edn? When I run just shadow-cljs
, it updates package.json and yarn.lock by calling yarn, and then it tells me "specify which action to run". I get what I want because package.json and yarn.lock are updated, but I think I may have not used the intended workflow. :target is :react-native
if that's relevant
Also, I call shadow-cljs with npx, and I don't install npm packages globally, in particular yarn isn't installed globally. Consequently when shadow-cljs
calls yarn, it complains IOException: Cannot run program "yarn" (in directory "."): error=2, No such file or directory
. I work around that by calling shadow-cljs through yarn through npx: npx yarn shadow-cljs
. Is that the intended way?
Update: I guess the correct answer to this is don't mix npm/npx and yarn like this. Use npm and package-lock.json and npx, or use yarn by installing it globally and use yarn.lock.
yeah don't mix. shadow-cljs wants to infer which tool you are using look looking for the lock files. so if there is a yarn.lock
it'll attempt to use yarn
.
Using shadow-cljs v2.12.5, I run into a very weird bug where functions in a long namespace (5 namespace segments) are resolved at runtime to nil
.
Did it happen to anyone before?
not enough information to comment. it is rather unlikely that the number of namespace segments is the cause here. much more likely to be related to something else.
I will try to reproduce on a smaller project after work. I am using shorter namespaces (4 namespace segments) as a workaround.
FWIW pretty much all my projects have 5 or more segments. even the shadow-cljs UI has 5 https://github.com/thheller/shadow-cljs/blob/bbbac5ede9b0cefb48224050a06c673203431685/src/main/shadow/cljs/ui/components/inspect.cljs#L1
Ok. I guess the bug appears as a side effect of something else. I will still investigate.
@thheller I could reproduce 2 of the bugs we encountered with the latest version of shadow-cljs https://github.com/thheller/shadow-cljs/issues/874
When I add reagent as a cljs dependency to shadow-cljs.edn and run shadow-cljs, it calls npm to add react and react-dom as deps to package.json. What's the mechanism here that triggers this? Looking at the reagent source code, there's deps in package.json to react and react-dom, but there's also prop-types and cljs-oss/module-deps there, which shadow-cljs doesn't add to package.json. What happens here?
reagent declares its npm dependencies via deps.cljs https://github.com/reagent-project/reagent/blob/master/src/deps.cljs
you can set :npm-deps {:install false}
in your shadow-cljs.edn
to disable to automatic install
Can closure defines be used within macros? I want to configure a build against various configuration files by specifying their path as a closure-define. I want a macro read the specified file at compile time and bind its contents to a var. Here's the macro I use:
(defmacro def-from-file [var path-to-file f]
`(def ~var
(~f ~(read-string (slurp path-to-file)))))
I've been unable to call the macro with file
being the value bound to a closure define.
With the shadow-cljs guide stating that closure defines āare essentially compile time constantsā I thought there must be a way to eval them inside macrosā¦ is that actually possible? If not, are there other ways to do what I'm looking for here?Many thanksā¦ that library look great, but for now I'll keep it simple and just access cljs.env/*compiler*directly. Thanks for pointing me at it!
something like this https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/prefs.clj#L8-L12
Hey friends, wanted to ask if Iām thinking about this correctly: I have a clojure codebase and I want to add a coupleĀ `.cljc`Ā namespaces to it and create a jar thatĀ onlyĀ includes those namespaces using a separate profile for consumption as a library in a clojurescript project. Is that necessary or should I just create a single jar for the whole thing?
:thumbsup::skin-tone-2:, does it need to be an uberjar? I donāt know how dependencies all resolve
might make sense to make a separate library that both use, your clj code won't be used by cljs project I assume
I have this snippet
(defn copy-to-clipboard [val]
(let [c (.-clipboard js/navigator)]
(-> (.writeText c val)
(.then (fn [] (debug "copied to clipboard")))
(.catch (fn [e] (error "clipboard error:" e))))))
i suspect I need to properly require the navigator stuff, but im not quite sure of the mechanics
in reference to: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard
^js
hint you only need if things are getting renamed but it doesn't seem to be renamed
pretty sure you are only allowed to access that after asking permissions first? did you do that?
yeah, that is a distinct possibilityā¦i havent got that far yet, but i would have expected an exception over permissions, not a seemingly symbol undefined error
just for sanity try logging js/navigator
and see what that is. maybe it is redeclared somewhere locally or so
The navigator object is there, but it doesnt have the clipboard property, giving legs to your theory on permissions
Hey folks.
Iām trying to connect to socket repl in a shadow project.
My project is based on this template, I didnāt change too much stuff: https://github.com/day8/re-frame-template
Iām doing the following:
1. lein watch
2. In Emacs, I use inf-clojure-connect
with localhost
and the port in .shadow-cljs/socket-repl.port
. The repl opens fine.
3. Then, when I try to eval any require
, I get errors such as:
Could not locate timeline/test_utils__init.class, timeline/test_utils.clj or timeline/test_utils.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
Iāve tried to have a look at shadowās manual but Iām not too familiar with cljs and front-end.
Am I missing something?when that repl opens up, type (help)
. I think there's a small banner indicating this. You get a clojure repl and you can start your repl with (shadow/repl :your-build)
shadow-cljs - REPL - see (help)
To quit, type: :repl/quit
shadow.user=>
or (shadow/browser-repl)
or (shadow/node-repl)
if you don't have a build configured yet and just want a REPL
A more general issue:
Thereās one test that passes in the repl, but it fails with karma
.
What would be a good approach of debugging that? :thinking_face:
I guess I can bisect and run karma
, just wondering if thereās a more efficient way
@thheller I could reproduce 2 of the bugs we encountered with the latest version of shadow-cljs https://github.com/thheller/shadow-cljs/issues/874