membrane

zimablue 2022-08-12T15:58:31.614639Z

hey man, something that I did is comment out a few sections which assume the existence of a browser so that I can run parts in the backend for convenient REPLING/testing

phronmophobic 2022-08-12T16:06:26.376039Z

yea, adding support for that would definitely be an interesting improvement

zimablue 2022-08-12T16:08:34.958489Z

there's a few possible approaches to how one dispatches , it's harder because things are being run on library import so I'm not sure how one would use eg. a global variable, I use this for electron: (def is-main? (not= (.-type (js/require "process")) "renderer")) It might be worthwhile to eliminate the things that happen on import, then one could just call a global function to post-hoc enable/disable browser-specific features

phronmophobic 2022-08-12T16:10:43.880919Z

You should be able to use the full membrane.ui and membrane.component namespaces without a backend. what namespaces do you need besides those for testing?

zimablue 2022-08-12T16:13:10.761649Z

interesting, I hadn't tested namespace by namespace, I just called my UI code and checked whether it worked. atm my UI code imports WebGL in several places not just at top level, eg. to implement IDraw

phronmophobic 2022-08-12T16:24:25.993349Z

do you need IDraw for testing?

zimablue 2022-08-12T16:28:38.779289Z

well, I want to test component-generating pipelines that output collections of components that I've implemented IDraw on, so unless I patch each component out in the backend I do need it. One can get around anything with enough mocking and patching but to me it seems simpler for the eg. "membrane.webgl" to have defaults that if browser deps don't exist it will import without throwing, instead of user/consumers of the library having to structure their code so that every component implementing IDraw has been mocked out for the unit test.

zimablue 2022-08-12T16:29:34.458019Z

just a thought, it only took me adding around 5 if blocks, basically fonts and audio from what I can see/remember

phronmophobic 2022-08-12T16:44:45.977069Z

I'm not a big fan of silent failure, but adjusting membrane.webgl to load the top level forms without specific browser APIs probably makes sense. Basically, it would fail on first use rather than on load.

zimablue 2022-08-12T16:51:00.042759Z

If run! Exploded then I think the tests would all work fine

👍 1
zimablue 2022-08-12T16:51:29.590859Z

The stuff which it's useful to run asynchronously could have errors sitting in channels/promises that will only be exposed on take! Also

zimablue 2022-08-12T16:51:41.535769Z

If that was a performance consideration

phronmophobic 2022-08-12T16:56:10.033469Z

another option is to write all the membrane.webgl stuff against protocols so you could mock it.

phronmophobic 2022-08-12T16:57:16.784619Z

which is kind of orthogonal to other improvements

phronmophobic 2022-08-12T16:57:28.581129Z

anyway, I'll create a github issue

zimablue 2022-08-12T16:57:54.557269Z

thanks, I wasn't meaning to criticize just describing a usecase/workaround I'd had

zimablue 2022-08-12T16:58:08.649609Z

how do I fix this "membrane needs prep" error with the latest version?

phronmophobic 2022-08-12T16:58:44.443239Z

no offense taken! it's all helpful feedback! there's always room for improvement

phronmophobic 2022-08-12T16:59:53.913859Z

I'm not sure how to fix the "membrane needs prep" error. how does that occur?

phronmophobic 2022-08-12T17:00:02.783209Z

is that from switching back and forth between different versions?

phronmophobic 2022-08-12T17:00:48.694069Z

if you're just using the cljs version, I think the prep step is completely superfluous, but I'm not sure how to appease the clojure cli

phronmophobic 2022-08-12T17:06:44.611529Z

here's the issue, https://github.com/phronmophobic/membrane/issues/49

zimablue 2022-08-12T17:32:05.730039Z

Thanks

zimablue 2022-08-12T17:32:48.797669Z

putting the error in a seperate thread

zimablue 2022-08-12T17:33:39.624039Z

the erorr is: Error building classpath. The following libs must be prepared before use: [com.phronemophobic/membrane], the solution in clojure docs: clj -X:deps prep doesn't work, the command I'm using in general is shadow-cljs compile <my-app> or shadow-cljs watch <my-app>, nuking .shadow-cljs didn't help

phronmophobic 2022-08-12T17:35:38.718379Z

what happens when you run clj -X:deps prep?

zimablue 2022-08-12T17:36:13.569139Z

It doesn't fail but doesn't say that it's doing anything with membrane

phronmophobic 2022-08-12T17:37:13.152999Z

does clearing the <project dir>/.cpcache directory help?

zimablue 2022-08-12T17:39:34.011799Z

Ah good question

zimablue 2022-08-12T17:40:01.584159Z

Doesn't help

phronmophobic 2022-08-12T17:41:27.926219Z

I guess there's also the -Sforce

phronmophobic 2022-08-12T17:42:23.128049Z

Do you know when the error started appearing? Did switch between different branches? Merge branches? Change dependencies?

phronmophobic 2022-08-12T17:43:24.987529Z

The only other thing I can think of is to cherry-pick the following commits from the main branch: 82677ab6e492b2c8cd4871dceb540a7d890fee45 75d38cca6973a4cdd073d3c0a41cb7fb3f48ad77

zimablue 2022-08-12T17:44:44.878889Z

It's when I rebased onto main from an older version, I think the deps.edn has changed to include this prep key

phronmophobic 2022-08-12T17:45:03.939449Z

oh weird

phronmophobic 2022-08-12T17:46:23.670259Z

ok, I wonder if that means the prep step is silently failing?

phronmophobic 2022-08-12T17:49:04.352949Z

what happens when you run clojure -T:build compile ?

phronmophobic 2022-08-12T17:49:45.041749Z

does the directory <project dir>/target/classes exist?

phronmophobic 2022-08-12T17:49:56.695529Z

are you running the prep step from the root of your project?

zimablue 2022-08-12T18:10:01.595869Z

Sorry I had to head out

👍 1
zimablue 2022-08-12T18:10:24.791389Z

I will check later tonight, thanks a lot for your help

zimablue 2022-08-12T18:10:34.581859Z

Yes was running from root

zimablue 2022-08-13T17:09:33.946809Z

clojure -T:build compile (in my project root) first errored because I didnt' have the alias in my main project deps.end, when I added that option with the same map as in phronmophobic, clojure -T:build compile did work but didn't help with the original err

zimablue 2022-08-13T17:10:42.087359Z

./target/classes I don't tihnk existed, I aded it but it didn't help

phronmophobic 2022-08-13T21:25:02.397869Z

ok, now that the compile step works, does calling clj -X:deps prep fix it?