Fork me on GitHub

Hello 👋 , is there a way to get the shadow-cljs repl to indent output? or even add some coloring?

[email protected]:~/git-repos/zebra/quagga$ yarn start-repl
yarn run v1.22.10
$ shadow-cljs cljs-repl app
shadow-cljs - config: /home/apiyo/git-repos/zebra/quagga/shadow-cljs.edn
shadow-cljs - connected to server
NPM dependency "highlight.js" has installed version "10.1.1"
"10.7.2" was required by jar:file:/home/apiyo/.m2/repository/superstructor/re-highlight/0.0.2/re-highlight-0.0.2.jar!/deps.cljs
cljs.user=> (js/console.log "test")
cljs.user=> (require 'quagga.components.dataview.table.subs-test)
> (cljs.test/run-tests 'quagga.components.dataview.table.subs-test)

Testing quagga.components.dataview.table.subs-test

FAIL in (flatten-dataset) (quagga/components/dataview/table/subs_test.cljs:25:8)
expected: (= flattened-record-list (subs/flatten-dataset record-list))
  actual: (not (= {:kids [nil], :kids/kids_details [[{:kids/kids_age 2, :kids/kids_name "Tom", :kids/immunization_info [{:kids/vaccine "Polio"} {:kids/vaccine "Rickets"}]} {:kids/kids_age 5, :kids/kids_name "Dick", :kids/immunization_info [{:kids/vaccine "Malaria"} {:kids/vaccine "Flu"} {:kids/vaccine "Polio"}]}]], :kids/nested_group [nil], :formhub [nil], :top-level-records ({:_id 60381, :_attachments [], :_media_all_received true, :kids/has_kids "1", :_duration "", :formhub "Repeat with 0 answers", :_xform_id_string "nested_repeats", :_total_media 0, :_status "submitted_via_web", :_submitted_by "frankapiyo", :formhub/uuid "f19b44ccf710492eb4d1ed6f468324f1", :meta/instanceID "uuid:0f100159-280c-49a6-be7d-04460506b37d", :_edited false, :kids/nested_group "Repeat with 0 answers", :kids/kids_details "Repeat with 2 answers", :_tags [], :kids "Repeat with 0 answers", :_bamboo_dataset_id "", :_submission_time "2020-12-03T07:06:50", :_uuid "0f100159-280c-49a6-be7d-04460506b37d", :web_browsers "", :_version nil, :_notes [], :_media_count 0, :_geolocation [nil nil], :_xform_id 2231})} {:kids [nil], :formhub [nil], :top-level-records ({:_id 60381, :_attachments [], :_media_all_received true, :kids/has_kids "1", :_duration "", :formhub "Repeat with 0 answers", :_xform_id_string "nested_repeats", :_total_media 0, :_status "submitted_via_web", :_submitted_by "frankapiyo", :formhub/uuid "f19b44ccf710492eb4d1ed6f468324f1", :meta/instanceID "uuid:0f100159-280c-49a6-be7d-04460506b37d", :_edited false, :kids/kids_details [{:kids/kids_age 2, :kids/kids_name "Tom", :kids/immunization_info [{:kids/vaccine "Polio"} {:kids/vaccine "Rickets"}]} {:kids/kids_age 5, :kids/kids_name "Dick", :kids/immunization_info [{:kids/vaccine "Malaria"} {:kids/vaccine "Flu"} {:kids/vaccine "Polio"}]}], :_tags [], :kids "Repeat with 0 answers", :_bamboo_dataset_id "", :_submission_time "2020-12-03T07:06:50", :_uuid "0f100159-280c-49a6-be7d-04460506b37d", :web_browsers "", :_version nil, :_notes [], :_media_count 0, :_geolocation [nil nil], :_xform_id 2231})}))

Ran 8 tests containing 23 assertions.
1 failures, 0 errors.

Done in 654.01s.


or, is there some kind of shell that would automatically indent edn that you know of?


you could run your tests somewhere else, if you use emacs, cider has a good UI for test results


this is cljs.test output. little shadow-cljs can do to influence that

Daniel Strokovsky14:08:41

Hi! What is the best / recommended way to wrap a library that uses a js library? Could it be used in a library built by figwheel? Some background: we want to create a common component library (built with shadow) but we are still using figwheel in one of our libraries so I was wondering if that would even work.


if you're building a CLJS library your build tool shouldn't have much effect


since a CLJS app would include it as source, not as a built JS artifact


you might have some trouble with the js library though. out of the box figwheel doesn't provide those


so you either need a cljsjs package alternative of the figwheel users need to use the new-ish :target :bundle from regular CLJS

Yehonathan Sharvit08:09:18

How would it work if the app is built with shadow? I mean how will shadow know that a cljs lib A uses a JS lib B?


in A you add a deps.cljs file with {:npm-deps {"lib-b" "version"}}

Yehonathan Sharvit09:09:28

Does :npm-deps work only with shadow ?

Yehonathan Sharvit09:09:06

I am asking in two contexts: 1. Does lib A need to be built with shadow? 2. Does an app that consumes lib A need to be built with shadow?


libs are source only. they don't contain ANY compiled artifacts whatsoever. so no they have no reliance on shadow-cljs whatsoever


:npm-deps is a regular CLJS option, it is information only. acting on it may require calling a function. eg. cljs.main with --install-deps or so


but again ... the context here is a library doing something like (:require ["react" :as react])


something needs to provide react. shadow-cljs will just do so via npm. regular CLJS and figwheel will not


so they either need cljsjs/react or using :target :bundle with webpack or so


(in both those cases :npm-deps are entirely irrelevant since the cljs compiler will not handle npm at all)

Yehonathan Sharvit14:09:54

Thank you @U05224H0W for your explanation

Jakub Holý (HolyJak)18:08:12

Is this the latest guide It reads > Version 1.0,Jan 10, 2018 > I suppose there have been changes since that?


yeah I never update the date. date will be removed entirely soon ;)

Jakub Holý (HolyJak)18:08:53

Also, did not shadow had a standalone web page? points just back to the GH repo...

Ryan Jerue19:08:54

There’s It may be useful to update the url under About to one of those @U05224H0W

👍 1
Ryan Jerue19:08:48

That is the latest guide. I think the date is just wrong @U0522TWDA Source for the docs is here, I think

👍 1

webpage is down currently. I'll work on restoring it soon

Braden Shepherdson23:08:05

is there a command I can send to my shadow-cljs session to kick all the connected tabs? I split my work between two computers, and while they both get code updates all the Fireplace.vim commands are going to only one of them.


why kick? you can select which tab to talk to when starting the REPL. don't know how in fireplace though


oh there is also :repl {:runtime-select :latest} (top-level shadow-cljs.edn) to always pick the last connected runtime for the REPL instead of the first

Braden Shepherdson15:09:05

ooh! that sounds perfect. then I can just refresh when I switch machines.


fwiw you can see the currently connected runtimes listed here http://localhost:9630/runtimes (or they log they id in the browser console on startup: shadow-cljs #4 ready! or so)


you can pick which runtime to talk to via (shadow.cljs.devtools.api/repl :the-build-id {:runtime-id 4})


don't know how fireplace does things so no clue how you'd tell it that

Braden Shepherdson15:09:16

I'd use :CljEval ...the above... to signal to the Clojure side of the REPL rather than the JS side.


ah so you can already supply the runtime id if you want to?


the automatic selection doesn't always give you what you want so having the option to pick is useful