Fork me on GitHub
#shadow-cljs
<
2018-04-17
>
justinlee00:04:11

change it in package.json and then run npm install. restart shadow and it should pick it up

alex-dixon07:04:16

Do you know the consequences of having a global install that’s out of sync?

thheller08:04:12

it always uses the one installed in the project over the global one so it should not be a problem.

mjmeintjes06:04:01

I'm getting "Too many open files" error every now and then:

[:app] Compiling ...
[:app] Build failure:
FileNotFoundException: /home/matthys/projects/personal/learning/src/learning/web/topic_notes/core.cljs (Too many open files)
	java.io.FileInputStream.open0 (FileInputStream.java:-2)
	java.io.FileInputStream.open (FileInputStream.java:195)
	java.io.FileInputStream.<init> (FileInputStream.java:138)
	 (io.clj:229)
	 (io.clj:229)
	 (io.clj:69)
	 (io.clj:165)
	 (io.clj:165)

mjmeintjes06:04:43

I can create an issue for this, but not really sure what information I can provide. How would you go diagnosing this?

thheller08:04:59

@mjmeintjes if you are on linux/osx you can use lsof -p <pid> to list the open files of the shadow-cljs process. jps should list the pid. not sure where the leak could be coming from so knowing which files are open would help a lot

thheller08:04:39

might also be an external process with too many files open though. doesn't have to be the shadow-cljs process since its a user limit not a per process limit IIRC

mjmeintjes08:04:38

Thanks, that helps. If it happens again I'll open an issue if it looks like shadow-cljs is at fault.

pez09:04:53

@thheller: I edited the github project wiki to add info about Calva for editing shadow projects: https://github.com/thheller/shadow-cljs/wiki/Calva

pez09:04:41

(I know it said deprecated, but didn’t see how to edit the other user guide, and people will look at the wiki pages as long as they are there anyway.)

thheller09:04:25

cool thx. I will add it to the user guide later. or you send make a PR if you want https://github.com/shadow-cljs/shadow-cljs.github.io

Chris Bidler12:04:09

@pez: I want to say that I took Calva for a spin yesterday with a shadow-cljs project I have here and so far it looks really good

pez12:04:34

Oh, yay. Thanks for letting me know!

Chris Bidler12:04:54

like, “maybe I can finally stop scaring off the youths with my and then you simply download 'emacs'... speech when trying to infect them with The Clojure” good

Chris Bidler12:04:12

I will have to dig through the extensions list and see if there’s anything that can hold a candle to magit and org-mode before get too serious about Code as a daily driver, but Calva seems to do really well for a REPL 🙂

pez13:04:13

The org extension doesn’t seem to match emacs org-mode very well. But GitLens together with the built in Git support is very good, I think. Maybe not magit-level, keyboard-wise, but still good.

pez13:04:54

But the download emacs thing is a good way to weed out the weak. 😃

Chris Bidler13:04:12

well, that’s certainly true, but I do think that being able to demonstrate the REPL workflow in a “modern editor” might get some of those “weaklings” interested enough to start lifting some mental weights, so to speak

Chris Bidler13:04:02

My experience has been that the vast majority of devs, once they see the REPL flow work, they will happily chew on emacs or JVM stacktraces or whatever for awhile to get what I’m selling hehe

pez13:04:30

That’s what happened to me. I was blown away and installed Emacs immediately.

pez13:04:56

I think I should put together a playground project for people to try out shadow-cljs together with the interactive programming Calva enables.

pez13:04:05

If you play some with Calva for shadow-cljs, I am eager to learn if something does not work or if there is something that would make the experience better.

Chris Bidler13:04:55

I intend to use it for my interactions with the project I mentioned before (shipped, production SPA but that I don’t have many responsibilities over) and also when I spike moving our RN app from Boot to shadow-cljs sometime Real Soon™

Chris Bidler13:04:00

I will be sure to keep you posted

❤️ 4
pez16:04:36

Actually, it seems there are some problems evaluating (loading) files in the Clojurescript repl of shadow-cljs. This works more stably in Figwheel’s repl. I have some investigation to do.

thheller16:04:24

@pez I only tried the plugin briefly but it seemd to have a few issues

thheller16:04:19

couldn't get it to work properly. it seems weird to me that it forces me to select a CLJS repl before I actually do anything.

thheller16:04:47

I think there are a few issues with your approach that might cause problems

pez16:04:46

How do you mean before you actually do anything?

thheller16:04:07

ie. in my work project I usually have 2 builds running. say one for the server one for the browser. if Calva tries to unconditionally load the CLJS file I'm currently working on in the REPL that will cause problem

thheller16:04:16

some server files can't be loaded in the browser repl

thheller16:04:31

I open the project, open a CLJS file and it asks me which build

thheller16:04:44

didn't tell it to connect or anything

pez16:04:59

It defaults to autoconnect. This is a setting. Maybe it should default to not do that. But I am not sure that is the whole story behind what you mean with “my approach”?

thheller16:04:38

it seems to try to load the file I'm working on in the REPL?

thheller16:04:52

don't know why it did that when I didn't tell it to do that

pez16:04:53

I come from an environment where there is cljs in the browser and clj on the server.

thheller16:04:28

I also have clj on the server but I do have several CLJS builds in my project

pez16:04:54

It loads the file so that evaluating forms will be more likely to work.

thheller16:04:04

yeah but that doesn't work

pez16:04:19

Tell me why.

thheller16:04:48

assume this simple scenario. CLJS on the server, CLJS in the browser.

thheller16:04:13

:server build is :node-script running in node. :app build is :browser

thheller16:04:26

I have the my.app.server file open. it imports various node packages

pez16:04:32

Yes, that is a scenario that breaks things right now.

thheller16:04:34

but I'm connected to the :app REPL

thheller16:04:53

same for two different :browser builds. I have one for the website and one for the admin interface

thheller16:04:19

can't load admin stuff in the website

thheller16:04:07

add a react-native app to the mix and so on

thheller16:04:25

not all cljs files run in all cljs builds

pez16:04:59

I will have to go back to the drawing board for properly supporting shadow-cljs, I think. Can you tell me how you would like it to work?

thheller16:04:54

well its part of a greater problem really. I have no idea how to address this.

thheller16:04:17

In Clojure you only have one runtime. everything is nice and easy.

thheller16:04:38

in CLJS it is not since there are many different platforms and it is very likely that you'll be talking to many at once

thheller16:04:50

there is also the problem of many connected runtimes.

thheller16:04:12

say you build a react-native app and have the app open in iOS and android. which do you use to eval the REPL code in?

thheller16:04:33

or the browser open in chrome and firefox?

pez16:04:45

I ran into that problem today. shadow-cljs told me it couldn’t evaluate for me.

thheller16:04:49

its a problem you do not have for Clojure since there is only Clojure.

pez16:04:06

I haven’t run into the problem with Figwheel, though.

thheller16:04:16

figwheel cheats

thheller16:04:33

it just sends the eval to everything that is connected and displays the first result that comes back

pez16:04:53

I see. 😃

pez16:04:58

But if we put that problem apart, which seems to be much bigger than Calva… Maybe if for shadow-cljs projects Calva asks for which build for every file that is opened? Possibly trying to remember per file between sessions.

thheller16:04:35

that doesn't work because many files are shared and used in many builds

thheller16:04:47

the only issue I have really is that it auto-evals

thheller16:04:00

just let me manually eval what I want and everything is fine I think

thheller16:04:28

if I can toggle it to off that is fine too

pez16:04:13

But Calva only lets you have one build connected per workspace. Will that work?

thheller16:04:35

I gotta go. I will experiment with this some more tomorrow.

thheller16:04:42

as long as I can switch it yes thats fine

pez16:04:48

You can’t at the moment. Well, maybe you can reconnect and that has that effect, sort of.

javi17:04:25

this may be a stupid question, can i set different :output-dir for :dev and :release? it seems the answer is yes from the docs... but maybe i am having a slow day and can't see it clearly. use case is i have watch running but i also have a quick test deploy script the compiles the same build but in release and deploys to surge.sh.

javi17:04:18

so TLDR: can i run a release build if the same build is being watched? if so.. how do i set a different output folder?

thheller17:04:25

:release {:output-dir "foo/bar"}

👍 4
Jon17:04:46

Refresh http://shadow-cljs.org/ and good luck!

16
pepe17:04:53

I didn't know about :module-hash-names. It is actually great feature for me.

😃 4
pez18:04:15

@thheller I just published an update of Calva that does not auto evaluate files. Might make it an opt-in later, but this is a saner default considering all different kinds of workflows and project setups. I’m still pondering on how to support build switching. For now reconnecting might work. Please let me know if you try it out some more, what works and not.

pez18:04:33

Loading of files does not seem to work through the shadow-cljs Clojurescript repl connection. So added a greeting note in the app log channel about a possible workaround which is to select all contents of the file and evaluate it.