Fork me on GitHub
#shadow-cljs
<
2021-06-22
>
Aron08:06:20

anyone actively uses react native with shadow cljs?

souenzzo14:06:21

i developed an #fulcro app targeting react native since before #shadow-cljs support react-native (~2019). I used npm-module target and things work pretty well Even things like hot reload works in some how Now I already ported most of the things to react-native target and etc I'm just sharing that things in cljs/shadow are pretty stable and you can trust them 🙂 I still think that in 2019 I had the better/fastest code-reload/dev-experience available in react-native world. And the setup to share code between native and web is WAY simpler than anything with webpack

Aron14:06:20

yeah, react in 2017 was faster than react@next is now

Aron08:06:06

never mind, it just started working on its own. dark magic

2
Aron08:06:33

took me more than a week from first cloning the react-native repo with shadow config 😄

Aron09:06:07

it's difficult to follow something which starts from assumptions that I am ignorant about 🙂

Aron10:06:42

That was the repo I was specifically mentioning. I tried to do those steps, and it took me over a week to get to the place where everything connects. For two days the build was working but for some reason the websocket had issues. That was the last thing, and that was the only thing that fixed itself. It requires an emulator or usb, which i haven't tested. took me a bunch of days just to be able to run the emulator, I had to disable wsl2 which contained all my working environment. Then, wherever should I get react-native binary in my PATH? I ended up using npx, so that's a diversion already, I have zero idea what you had set up. Then, for some reason, it requires create-react-class, I had to install that manually, there was no way around it. It's not part of your repo anywhere 🙂 To be clear, I am still 100% amazed that it works and it's all as promised and I am very grateful for everything.

jamescroft15:06:00

Hi there. I’m using :module-hash-names true and when I do a release build I get the fingerprinted file. However, if I then remove the .shadow-cljs folder and do another release build I get a file which has a different fingerprint even though there have been no code or dependency changes. It appears that the munged variable names are different. Q: is this expected? I assumed that the build process would produce identical output given identical input, but maybe that’s not the case?

thheller16:06:44

no, builds are not 100% deterministic. by deleting .shadow-cljs you are basically destroying the reproducible part 😉

jamescroft18:06:36

@thheller ok, thanks for confirming. Our builds are done on CI and we are not sharing the ‘.shadow-cljs’ between build machines. We were confused as to why our fingerprints change with every build even if there are no cljs code changes.

v3ga18:06:18

Can someone tell me what I'm missing here? I've added clojurescript/shadow-cljs to my project and when I go to my default index page I do get indication that it's picking up on shadow-cljs in the lower left corner. However as far as detecting any functions I write in core.cljs or even my cljs repl it's a no go. Not sure what else I'm missing or where I goof'd https://github.com/v3gal0g/chrysalis-xd

thheller18:06:19

@decim "However as far as detecting any functions" what does that mean? what are you doing exactly?

v3ga18:06:16

@thheller say I even try (js/alert “foo”) it doesn’t pick up on it. It looks like it should be reading my app.js file but it doesn’t appear so. I’m not quite sure, after tinkering for a few hours.

thheller18:06:25

I need more information

thheller18:06:29

WHERE do you type that?

thheller18:06:36

what commands did you run?

thheller18:06:23

> It looks like it should be reading my app.js file but it doesn’t appear so

thheller18:06:50

what do you mean by "It"? shadow-cljs generates the resource/public/js/app.js yes. it does not generate any HTML, so loading that file is up to you?

West19:06:00

So I tried following the instructions for using karma to test my code. Unfortunately my code is a node script and karma is a browser test suite, not designed for node. All I really want is some XML output so I can see the results in circleci. I don’t even know how to get more detailed tests, is there a verbose option? All I get is this when I run my test.

========= Running Tests =======================

Testing uniorg-util.cli-test

Testing uniorg-util.core-test

Ran 8 tests containing 31 assertions.
0 failures, 0 errors.
===============================================

thheller19:06:58

so I assume you found :node-test?

thheller19:06:59

> All I really want is some XML output so I can see the results in circlec

thheller19:06:11

not sure what you mean by that

thheller19:06:38

shadow has no built-in "xml output" for tests if thats what you are asking

West19:06:38

I see, so I would need to configure another test runner that supports junit style xml results?

thheller19:06:27

yeah you can configure custom runners with :node-test. in case those exist 😛

West20:06:28

So I managed to find https://github.com/lambdaisland/kaocha-junit-xml. I’m currently trying to see if I can get https://github.com/lambdaisland/kaocha-cljs2 working.

v3ga19:06:08

Generally people throw an index.html in resources/public/ as I did. Don’t worry about it I’ll figure it out, I’m sure it’s a beginners error. If not I’m familiar with figwheel.

thheller19:06:50

@decim and WHERE did you type (js/alert "foo")? there is a difference here to figwheel. you need either a connection from your editor or shadow-cljs cljs-repl app in addition to shadow-cljs watch app first

thheller19:06:01

so REPL is a separate process from the watch

v3ga19:06:41

Both using shadow-cljs repl and from emacs evaluating it in (core.cljs) with ‘npx shadow-cljs watch app’ running. Also I apologize if I came off as rude. I’m not slighting your project by any means. The issue is on my end.

thheller19:06:38

@decim I'm trying to help you but I don't have a clue what you are doing so I'm asking what you are doing. you are only giving me small pieces of information that don't really tell me what you are doing.

grav20:06:32

Hey! Whenever I make a change in my cljs.user, and Shadow-cljs hot-reloads it, and I then try executing something in the repl, I get the following exception:

------ REPL Error while processing ---------------------------------------------
foo
no source by provide: cljs.user
{:provide cljs.user}
ExceptionInfo: no source by provide: cljs.user
	shadow.build.data/get-source-id-by-provide (data.clj:186)
.....
Only seems to be the case for cljs.user

thheller20:06:21

@grav which version are you on? that should have been fixed for a while now?

grav20:06:10

@thheller Latest: 2.14.5

grav20:06:36

Here's more info:

[2021-06-22 22:07:23.472 - WARNING] :shadow.cljs.devtools.server.worker.impl/cljs-compile-ex - {:input {:code "foo", :ns cljs.user, :repl true}}
ExceptionInfo Failed to process REPL command {:eof? false, :ns cljs.user, :form foo, :source "foo", :tag :shadow.cljs.repl/process-ex}
        shadow.cljs.repl/process-read-result (repl.clj:501)
        shadow.cljs.repl/process-read-result (repl.clj:475)
        shadow.cljs.repl/process-input (repl.clj:659)
        shadow.cljs.repl/process-input (repl.clj:637)

grav20:06:30

I'm using :deps {:aliases [:cljs]}, and then I have :paths ["src" "dev"] in my deps.edn, and cljs.user is in dev/cljs/user.cljs

thheller20:06:09

would help if you can setup a reproducible repo

grav20:06:52

Alright - I'll see if I can do that :thumbsup: Is there a work-around for now, can I eg avoid having shadow hot-reload cljs.user

thheller20:06:22

you can have (ns cljs.user {:dev/once true} ...) meta to only load it once. not sure that fixes anything

grav20:06:46

Doesn't seem to unfortunately.

grav20:06:04

Tried to use :repl-init-ns with another namespace - same problem with that namespace. Anyway, I'll create a repro.

grav20:06:40

@thheller There you go: https://github.com/grav/shadow-cljs-user-issue 🙂 Will also create an issue

grav20:06:12

Created issue here: https://github.com/thheller/shadow-cljs/issues/905 Thanks for looking into it 🙂

v3ga21:06:50

Ha I got it! In shadow-cljs.edn…. :modules {:app … changed that to main and pulled main.js in index.html and now we have lift off.

🎉 5