This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-27
Channels
- # aws (19)
- # babashka (47)
- # beginners (111)
- # boot (3)
- # bristol-clojurians (3)
- # chlorine-clover (2)
- # cider (13)
- # cljs-dev (8)
- # clojure (143)
- # clojure-europe (11)
- # clojure-germany (10)
- # clojure-italy (3)
- # clojure-losangeles (1)
- # clojure-nl (1)
- # clojure-spec (6)
- # clojure-survey (3)
- # clojure-uk (42)
- # clojurescript (229)
- # conjure (131)
- # cursive (21)
- # data-science (18)
- # datomic (4)
- # emacs (21)
- # events (2)
- # figwheel-main (12)
- # fulcro (18)
- # graalvm (1)
- # hoplon (40)
- # jobs (1)
- # joker (17)
- # kaocha (1)
- # lambdaisland (1)
- # off-topic (19)
- # rdf (7)
- # re-frame (31)
- # reagent (26)
- # reitit (20)
- # rum (4)
- # shadow-cljs (106)
- # sql (17)
- # testing (5)
- # vim (2)
i'm on the latest version of shadow-cljs (2.8.104) and just recently started getting a compilation error in my CI for a project that really hasn't changed:
shadow-cljs - dependencies updated
[2020-04-27 12:10:51.037 - WARNING] :shadow.build.classpath/bad-jar-contents - {:jar-file "/Users/myuser/.m2/repository/cljs-bean/cljs-bean/1.5.0/cljs-bean-1.5.0.jar", :bad-prefix "cljs_bean/from/", :bad-count 1}
shadow-cljs - HTTP server available at
shadow-cljs - server version: 2.8.104 running at
shadow-cljs - nREPL server started on port 9999
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
The required namespace "cljs-bean.from.cljs.core" is not available, it was required by "cljs_bean/core.cljs".
after clearing my project's .shadow-cljs
dir, i started getting the same error locally. when i unzip the cljs-bean-1.5.0.jar
in my m2 folder, i can see the namespace is there:
system:cljs myuser$ pwd
/Users/myuser/.m2/repository/cljs-bean/cljs-bean/1.5.0/unzipped/cljs_bean/from/cljs
system:cljs myuser$ ls
core.cljs
any thoughts are much appreciated!haha oops. I added a protection against jars containing compiled and uncompiled cljs sources by looking for /cljs/core.cljs
upgrading from 2.8.88 to 2.8.106 to try out the build caching change... and I get this:
shadow-cljs server
shadow-cljs - config: /home/dave/projects/owsy/gondola-client/shadow-cljs.edn
shadow-cljs - starting via "clojure"
Syntax error (NoSuchFieldError) compiling at (shadow/cljs/devtools/api.clj:1:1).
ES3
Full report at:
/tmp/clojure-6373547123142623863.edn
@davewo looks like a dependency conflict. need to bump your CLJS version as well if you have it decalred in deps.edn
are modules https://shadow-cljs.github.io/docs/UsersGuide.html#_modules working with react-native?
@yenda I did some groundwork to get that working yes but I don't know any of the react parts to actually get it to lazy load
for the build part you would set :chunks {:foo {:entries [some.ns]}}
in addition to the usual stuff
been a while since I did that and I never quite figured out the react-native parts so that it would actually lazy-load that code
:chunks
is the new name the closure stuff uses, moving away from :modules
so I just called in chunks to start
but its not the regular :modules
from a browser build. works slightly differently so that react-native can do its thing properly
last time I tied I added a (js/console.log "I'm loaded!")
the the ns that was supposed to be loaded when I click a button
the key is to make sure the clojurescript code doesn't call the inline require at startup, ie in a def for instance that wouldn't work
the chunking stuff should works for the basics, can easily expand it to allow more complicated configs
yeah we only need super basic stuff: translation files and some big js files that don't need to be loaded at startup
I'll double check but I'm pretty sure it's just about wrapping the js/require in a defn so that it's only required when needed and not when app starts
it might only work for release builds but in theory I set it up in a way that might also work for watch, probably not though. never could get it to lazy-load in any scenario
@thheller though that might not help very much https://github.com/thheller/reagent-react-native/blob/master/react-native/metro.config.js#L13 😄
yeah I don't do react-native myself. I never went beyond a couple hello worlds so no clue what any of it means 😛
gave up here https://reactnative.dev/docs/ram-bundles-inline-requires#configure-preloading-and-inline-requires 😛
it's for android only, and they made a new js engine called Hermes which AOT compiles the code. it's much better to use Hermes than ram bundles now
still loading early but it might just be dev, will have to wait a bit to test in release as I haven't fixed the android release build yet and ios is useless when it comes to logs
Hi, I constantly get this mongodb driver message in my shadow-repl, and I want to turn it off:
2020-04-27 15:43:14,333 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.6 ms, state=CONNECTED}, {address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=20.2 ms, state=CONNECTED}, {address=, type=REPLICA_SET_PRIMARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.4 ms, state=CONNECTED}]
2020-04-27 15:43:14,333 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.6 ms, state=CONNECTED}, {address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=20.2 ms, state=CONNECTED}, {address=, type=REPLICA_SET_PRIMARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.7 ms, state=CONNECTED}]
2020-04-27 15:43:14,932 [XNIO-1 I/O-13] DEBUG io.undertow.websockets.core.request - UT025003: Decoding WebSocket Frame with opCode 1
2020-04-27 15:43:22,145 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Checking status of
2020-04-27 15:43:22,145 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.protocol.command - Sending command '{"ismaster": 1, "$db": "admin", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1588016580, "i": 2}}, "signature": {"hash": {"$binary": {"base64": "w/czHSxejSRK/C/k02tdLQnaRxk=", "subType": "00"}}, "keyId": 6777715635859226627}}}' with request id 25260 to database admin on connection [connectionId{localValue:100, serverValue:103115}] to server
2020-04-27 15:43:22,161 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.protocol.command - Execution of command with request id 25260 completed successfully in 16.51 ms on connection [connectionId{localValue:100, serverValue:103115}] to server
2020-04-27 15:43:22,162 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.6 ms, state=CONNECTED}, {address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=19.6 ms, state=CONNECTED}, {address=, type=REPLICA_SET_PRIMARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.7 ms, state=CONNECTED}]
2020-04-27 15:43:24,338 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Checking status of
2020-04-27 15:43:24,338 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Checking status of
2020-04-27 15:43:24,339 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.protocol.command - Sending command '{"ismaster": 1, "$db": "admin", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1588016595, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "rOVQeuBwIEgQnmmAJs4ylRWzPtA=", "subType": "00"}}, "keyId": 6777715635859226627}}}' with request id 25261 to database admin on connection [connectionId{localValue:101, serverValue:107380}] to server
2020-04-27 15:43:24,339 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.protocol.command - Sending command '{"ismaster": 1, "$db": "admin", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1588016595, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "rOVQeuBwIEgQnmmAJs4ylRWzPtA=", "subType": "00"}}, "keyId": 6777715635859226627}}}' with request id 25262 to database admin on connection [connectionId{localValue:102, serverValue:132898}] to server
2020-04-27 15:43:24,363 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.protocol.command - Execution of command with request id 25261 completed successfully in 23.75 ms on connection [connectionId{localValue:101, serverValue:107380}] to server
2020-04-27 15:43:24,363 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.8 ms, state=CONNECTED}, {address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=19.6 ms, state=CONNECTED}, {address=, type=REPLICA_SET_PRIMARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.7 ms, state=CONNECTED}]
2020-04-27 15:43:24,363 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.protocol.command - Execution of command with request id 25262 completed successfully in 23.93 ms on connection [connectionId{localValue:102, serverValue:132898}] to server
2020-04-27 15:43:24,364 [cluster-ClusterId{value='5ea55fa97eda171d0065e0f9', description='null'}- DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=22.8 ms, state=CONNECTED}, {address=, type=REPLICA_SET_SECONDARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=19.6 ms, state=CONNECTED}, {address=, type=REPLICA_SET_PRIMARY, TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='US_EAST_1'}]}, roundTripTime=23.0 ms, state=CONNECTED}]
Another thing I don't understand is that the mongodb connection is in the back-end, so why would it show in the shadow repl?
I want to silence this logging information because it isn't helpful to me and detracts me from a good interactive experience in the repl. These messages appear periodically and move the position of the cursor and also the location of the prompt.
I have a simple .cljc file with the contents:
(ns my-proj.data
(:require #?(:clj [com.wsscode.pathom.connect :as pc]))
#?(:clj ::pc/hi)
the shadow cljs build is failing with:
Invalid keyword: ::pc/hi.
Is there something obvious I'm missing here?@danvingo the code is not readable in CLJS since it doesn't have the alias to resolve ::pc/hi
@pshar10 I guess you are running shadow-cljs embedded in lein or something? no clue why you'd be getting mongodb messages, it is shadow-cljs doing that
So I found this: https://github.com/michaelklishin/monger/issues/115
you if you run shadow-cljs as I recommend and not embedded in something else then you won't have this issue
Yeah, I understand. Anyway, I added this in my project.clj, [org.slf4j/slf4j-nop "1.7.12"] which is the proposed solution, but it didn't work. My setup is basically the Luminus template.
To replicate, you would make a Luminus app and then connect with a mongodb server in clj. The shadow-repl would still show the connection messages
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="10 seconds"> <statusListener class="ch.qos.logback.core.status.NopStatusListener" /> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> <encoder> <charset>UTF-8</charset> <pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern> </encoder> </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>log/vendo.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>log/vendo.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>100MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <!-- keep 30 days of history --> <maxHistory>30</maxHistory> </rollingPolicy> <encoder> <charset>UTF-8</charset> <pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern> </encoder> </appender> <logger name="org.apache.http" level="warn" /> <logger name="org.xnio.nio" level="warn" /> <logger name="io.netty" level="warn" /> <root level="DEBUG"> <appender-ref ref="STDOUT" /> <appender-ref ref="FILE" /> </root> </configuration>
A little side-question. There's this cider-test.el file for clj test support within cider. It would be good if there were an analogous one for running shadow cljs tests too. Do you have any idea what modifications would be needed in this file for that to be possible?
https://github.com/clojure-emacs/cider/blob/052290d080f58edc814dd7aa00b014d639c62974/cider-test.el
(:import org.slf4j.LoggerFactory
ch.qos.logback.classic.Level))
(defonce server (atom nil))
(def mongo-logger (LoggerFactory/getLogger "org.mongodb.driver"))
(def jetty-logger (LoggerFactory/getLogger "org.eclipse.jetty"))
(defn log-level
[level]
(let [levels {:error Level/ERROR}
l (get levels level Level/DEBUG)]
(.setLevel mongo-logger l)
(.setLevel jetty-logger l)))
This what I got for controlling log-level(ns my-proj.data
(:require #?(:clj [com.wsscode.pathom.connect :as pc]
:cljs [clojure.string :as pc]))
doesn't really matter what it resolves to if you are not going to use in it CLJS anyways
Is there a way to define a custom function in the shadow.repl namespace, because I want to automatically run shadow/watch for a couple of profiles?
You can invoke arbitrary functions from shadow's cli (and those can start the build with your requirements) https://shadow-cljs.github.io/docs/UsersGuide.html#clj-run
@U1UQEM078 my cider automatically runs this command:
/usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d refactor-nrepl:2.5.0-SNAPSHOT -d cider/cider-nrepl:0.23.0 server
Given this, where do I put the functions I need to run on the repl startup?You can configure the command cider uses to start the repl - https://docs.cider.mx/cider/cljs/shadow-cljs.html#_configuration
Those vars go in a .dir-locals.el
file:
((clojure-mode
(cider-preferred-build-tool . "clojure-cli")
(cider-clojure-cli-global-options . "-A:dev"))
So exactly I want this: 1. I start a shadow repl using M-x return ' and choose shadow 2. Then shadow.user> repl prompt is shown. 3. In this I always evaluate this: (do (shadow/watch :app) (shadow/watch :workspaces) (shadow/repl :workspaces)) 4. In order to run these functions automatically, what do I need to do exactly?
This might be a better question for #cider. I recall there being a custom command to start clojurescript REPLs...
I'm trying to run the kaocha-cljs library, and I've installed it by adding kaocha and kaocha depencies in my project.clj
But when I evaluate a kaocha test in the clj repl, I get the following error:
(run 'vendo.workspaces.cards_test) ;; cljs file
Caused by: clojure.lang.ExceptionInfo: No such namespace: @testing-library/react, could not locate _CIRCA_testing_library_SLASH_react.cljs, _CIRCA_testing_library_SLASH_react.cljc, or JavaScript source providing "@testing-library/react" (Please check that namespaces with dashes use underscores in the ClojureScript file name) in file /Users...
I installed this library through npm and it's in that cards_test namespace. How do I run kaocha tests then that include npm dependencies?