Fork me on GitHub
#shadow-cljs
<
2020-02-24
>
Parenoid08:02:00

it looks like Enlive https://github.com/cgrand/enlive is abandonware (the "it hasn't needed attention and just works argument" notwithstanding [but correct me if I am wrong]).... last google group activity more than four years ago and last update other than the README half a decade ago...

Parenoid08:02:29

are there other more current tools/approaches for getting data from the web commonly in use?

ro619:03:15

Have you looked at Hickory?

thheller09:02:58

@patrickanium probably a better question for #clojurescript

dakra09:02:57

Anyone used github actions to build a shadowcljs project? I would like to use https://github.com/peaceiris/actions-gh-pages to automatically build my shadowcljs project and publish it to gh-pages. Would be nice if I could use an existing action but couldn't find anything on the marketplace.

thheller10:02:38

I haven't looked into github actions at all yet. I suspect it is pretty straightforward though

thheller10:02:06

looks like you can just use that one?

thheller10:02:22

just switch the npm commands to only do npm run build

thheller10:02:36

and in your package.json set up a proper script for that

thheller10:02:53

"scripts":{"build":"shadow-cljs release your-app"} or so

zilvinasu11:02:17

@thheller just wanted to say thanks for shadow-cljs! been a while since I used CLJS, and with shadow-cljs it seems that things gotten better

๐Ÿ‘ 12
Saikyun13:02:44

when using :browser-target, and running shadow-cljs release app, what is the HTML-file supposed to call in order to call the init -function?

Saikyun13:02:31

this is how my index.html-file looks

thheller13:02:52

remove the init call completely and use :init-fn in the build config instead

Saikyun13:02:52

but when opening it after having released, my-ns isn't available as a global variable

Saikyun13:02:59

ah okay, thanks

thheller13:02:26

OR add ^:export to the init fn so its name is preserved

Saikyun13:02:57

config file makes sense ๐Ÿ™‚ I looked here and couldn't figure it out: https://github.com/shadow-cljs/quickstart-browser/blob/master/shadow-cljs.edn

Saikyun13:02:16

ah, but now I see you use ^:export there

lambder14:02:23

this is my shadow-cljs.edn

lambder14:02:38

{:deps         true

 ;; set an nrepl port for connection to a REPL.
 :nrepl        {:port 8777}

 :builds       {


                :test {:target    :node-test
                       :modules          {:base {:init-fn token-streamer.main/init}}
                       :output-to "out/node-tests.js"
                       :ns-regexp ".*-test"
                       :autorun   true}

               }}

lambder14:02:59

when I run shadow-cljs compile :true

lambder14:02:12

I'm getting this:

lambder14:02:15

[:test] Compiling ...
========= Running Tests =======================

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
===============================================
[:test] Build completed. (46 files, 1 compiled, 0 warnings, 1.52s)

lambder14:02:24

any idea why it doesn't see my tests?

plexus14:02:30

maybe my google fu is failing me, has anything been said before about bringing figwheel's "extra mains" feature to shadow-cljs?

plexus14:02:30

as in any indication about how doable/hard/easy easy it would be, or if there's an alternative, or if there is a desire to have it or otoh a choice not to do it.

thheller14:02:01

@lambder where are you tests? :modules does not apply to the :node-test target so if you expect that to do something it won't

thheller14:02:15

@plexus you'd have separate builds?

thheller14:02:24

I have not seen a convincing use-case that wasn't solved better by a separate build

thheller14:02:50

and do you have :paths ["src" "test"] in your deps.edn?

lambder14:02:09

I hoped for defaults

thheller14:02:23

the default is just ["src"]

lambder14:02:48

@thheller it worked. Thanks

plexus14:02:33

@thheller they are a lot more lightweight than separate builds, that's really their main draw

thheller14:02:51

what does that mean to you? lightweight?

thheller14:02:19

or phrased the other way .. what is "heavy" about separate builds?

plexus14:02:58

lightweight in the sense that every namespace only gets compiled once

thheller14:02:51

you emulate extra-mains via modules if you really want to but I really don't quite see the point

thheller14:02:02

in several scenarios it'll make your main build slower

thheller14:02:13

and in many others your main build will recompiled when it doesn't need to

thheller14:02:46

ie. you edit my.app.foo-test, no point in your main build doing anything for that

plexus14:02:48

might still be preferrable over having a handful of builds kick off in parallel. Thanks for the input.

thheller14:02:37

:modules {:main {:entries [] :preloads [my.app-tests]}}

thheller14:02:10

then in your HTML include the main.js and call the respectice "init" fn you want

thheller14:02:50

ie. make 2 and one calls <script>my.app.init()</script> while the other calls the tests

plexus14:02:15

makes sense, and very helpful! ๐Ÿ‘

dakra15:02:13

@thheller thanks. I managed to get the github actions for auto deploy to gh-pages to work. https://github.com/dakra/mui-templates

dakra15:02:31

but now I see that it works nice locally with e.g. shadow-cljs watch app but when I make a release shadow-cljs release app it doesn't show my chart and some things doesn't seem to work without any error output. I'm new to clojurescript, any tips to debug this or some common gotchas I've to look out for that makes the release different from the dev version?

thheller15:02:02

shadow-cljs release app --pseudo-names or shadow-cljs release app --debug will make things a little more understandable

dakra15:02:20

thank you very much. I'll check.

thheller15:02:57

check if your paths are correct

thheller15:02:09

if you just get a 404 for your scripts then your paths just aren't correct

dakra15:02:27

Hmm. I don't see any difference with either --pseudo-names or --debug. I don't get 404 anywhere. it works almost as expected just recharts is not displayed and some css looks slightly wrong which is correct when I do the dev build.

dakra15:02:21

It's rendered here https://dakra.github.io/mui-templates/ and locally in dev mode it looks nice. (repo is https://github.com/dakra/mui-templates)

thheller15:02:33

I suspect that its just an externs issue then

thheller15:02:58

in your build config turn on :compiler-options {:infer-externs :auto}

thheller15:02:50

that is one candidate

thheller15:02:30

change (fn [{:keys [classes] :as props}] to (fn [{:keys [^js classes] :as props}]

dakra15:02:02

Nice. Thank you very much again. that worked ๐Ÿ™‚

dakra15:02:28

That was a bit difficult for me as a clojurescript beginner to debug as there was simply no error anywhere

Derek Passen20:02:53

Looks like the shadow dashboard on 9630 is busted

main.js:52 Uncaught Error: No protocol method IProfile.perf-start! defined for type object: [object Object]

Derek Passen20:02:05

this is with 2.8.84 and 2.8.85

Derek Passen20:02:34

2.8.83 continues to work as expected

thheller21:02:14

@dpassen1 oops. fixed in 2.8.86

Derek Passen21:02:06

thanks. checking it out now

Derek Passen21:02:49

works great. thanks for the quick update