Clojurians
#boot
<
2015-07-10
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

petrus09:07:51

In porting a figwheel cljs app to use boot, I am getting a long stream of these errors when I run boot dev: 2015-07-10 11:51 java[5941] (CarbonCore.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)

petrus10:07:56

Having a hard time with Boot. It's complaining when I run boot dev:

clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/env__init.class or cljs/env.clj on classpath: , compiling:(cemerick/piggieback.clj:1:1)
          java.io.FileNotFoundException: Could not locate cljs/env__init.class or cljs/env.clj on classpath: ...
So I have placed an env.clj and env.cljs in my ~/src/cljs folder - didn't help. Then I searched for all references to env in my project and commented out offending code to see if I can get rid of the error, but still no luck.

crisptrutski10:07:52

@petrus using clojure 1.7 and recent clojurescript version?

petrus10:07:05

Let me check. I think the register_with_server error was caused by memory issues (I was running a lot of boot watchers)

petrus10:07:12

@crisptrutski: here is my build.boot set-env! call:

crisptrutski10:07:50

clojure version is set by boot, not your build.boot

crisptrutski10:07:40

can check with boot -V, and can pin it with BOOT_CLOJURE_VERSION=1.7.0 boot -V > boot.properties

petrus10:07:12

awesome! thanks guys. I got it working :smile:

colin.yates11:07:44

hi all - any one fancy helping me out getting compiled javascript into resources/public - banging my head against the wall with boot-cljs :simple_smile:

colin.yates11:07:50

I have tried: - putting main.cljs.edn in resources/public, src/cljs/resources/public, neither worked. Also tried passing the output-dir and output-to to compiler-options but that didn’t work. The closest I have come is for the compiled js to be in target/resources/public :wink:

crisptrutski11:07:16

@colin.yates: i think (set-env! :target-path “resources/public”)

crisptrutski11:07:57

boot as a system, rather than boot-cljs as a task (which handles the cljs.edn files), handles writing outputs from the fileset back to the project directory

crisptrutski11:07:27

there are some fileset sync functions to use in your own task if you want separate js / jar target paths i guess (haven’t used them)

colin.yates11:07:43

@crisptrutski: - ah I see - thanks. I don’t see how to construct my build.boot so only JS goes into resources/public - I guess that is the fileset sync functions you mentioned….

juhoteperi11:07:47

There shouldn't be a reason to have boot write the files to resources folder (instead of target folder)

juhoteperi11:07:28

I'm guessing you are trying to do this because you are serving static files from resources/public folder?

colin.yates11:07:36

yes, the javascript and CSS etc.

juhoteperi11:07:56

Instead of serving them as files, serve them as resources from classpath

juhoteperi11:07:07

e.g. compojure.route/resources

colin.yates11:07:44

so cljs->js ends up in target but I have a compojure route serving the target/js/main.js?

juhoteperi11:07:16

pretty much only time you should do anything with files in target/ is when you copy the .jar file from there

juhoteperi11:07:02

if you put cljs.edn in e.g. src/cljs/public/main.cljs.edn the compiled file should be in path "public/main.js", and you don't really need to care what the filepath is, because boot-cljs will add the resulting files to classpath so they are accessible using e.g. (io/resource "public/main.js")

colin.yates11:07:01

ah OK - I am not using ‘serve’, I am using http-kit

juhoteperi11:07:23

It's not serve thing, it's ring thing in general

crisptrutski11:07:04

is the resources path “dynamic” - ie if a separate process update the js in /target, will an existing ring server start serving the new content?

juhoteperi11:07:49

@crisptrutski: Nothing is updating anything in /target, they are updating stuff in fileset (theye

juhoteperi11:07:59

the tasks edit classpath dynamically

crisptrutski11:07:06

well, separate processes wouldn’t share a fileset, no?

juhoteperi11:07:31

do you mean separate boot proceses?

juhoteperi11:07:45

They can't really communicate using target folder

juhoteperi11:07:00

the state of target folder is indeterminate when boot is running

juhoteperi11:07:36

@micha could probably explain this better

crisptrutski11:07:53

ok, so for arguments sake - if a server was being run with lein ring, and cljs was being compiled with boot (eg. an app busy migrating)

colin.yates11:07:55

thanks both - @juhoteperi I will have a look at that snippet. I don’t get how boot and ring are communicating so I need to do some more reading I think. Specifically how uberjar works in this context etc.

colin.yates11:07:48

@juhoteperi - That whole project might just be the template I need - thanks

juhoteperi11:07:16

@crisptrutski: I'm not sure what would be proper way do that, the right way is to run both ring and cljs in boot (same process, same classpath)

colin.yates11:07:42

@juhoteperi - let me repeat - thanks, really, this project is exactly what I needed - thanks for your efforts

juhoteperi11:07:04

:simple_smile:

juhoteperi11:07:16

Boot core concept pages in boot wiki are good read, especially the fileset article should be very useful even when not writing boot tasks

crisptrutski11:07:21

thanks from me also - was just trying to understand jvm resource paths more, not question the wisdom :simple_smile:

juhoteperi11:07:18

Yeah it takes some time to get used to, I also used to serve files from filesystem instead of classpath when using Lein

juhoteperi11:07:51

Though nowadays I use classpath with Lein too, takes just a bit more magical configuration there but makes the code simpler

juhoteperi11:07:15

(and more portable, I think)

colin.yates11:07:17

@juhoteperi, I was just starting to respect you but then I noticed vim - really! (Oh, I didn’t just go there! :))

juhoteperi11:07:28

I'm thinking @micha is also vim user :smile:

colin.yates11:07:13

om/reagent, vim/emacs, cursive/counterclockwise - too many religious wars to fight :wink:

crisptrutski11:07:45

some cool tricks in this repo - the way you put the system + boot stuff together, and the “.no-reload” idea are new to me

colin.yates11:07:26

I really appreciate these types of projects which tie these things together. Very helpful

martinklepsch12:07:07

heyho everyone :simple_smile:

colin.yates12:07:26

howdy @martinklepsch

juhoteperi12:07:28

With Component it would probably be useful to use reloaded-repl, I might update Saapas to show that

crisptrutski12:07:50

hey @martinklepsch - you back in fernsentrum land now? (ps do those stickers even ship :simple_smile:)

martinklepsch12:07:40

Back in Fernsehturmland, yes. Crazy tired :smile:

martinklepsch12:07:31

Maybe they do. I haven’t hold one in my hands myself yet haha

colin.yates13:07:01

getting weird behaviour - application is running and loading the latest JS (thanks @juhoteperi), however not all CLJS changes are being pushed. For example, I have a ‘run-render’ fn which (js/console.log) and then (reagent/render). If I change that js/console.log I see the new text appear - great, however if I change any of the reagent component fns I see the run-render being executed (with the updated js/console.log) but not the updated reagent...

colin.yates13:07:26

this all used to work in lein figwheel so I don’t think I have any muppet mistakes (but open to the notion that I have)

micha14:07:09

lol sorry that wasn't meant for you colin.yates

colin.yates14:07:34

@micha :simple_smile:

micha14:07:35

pls disregard, wrong chat

mikethompson14:07:43

@colin.yates: I'm wondering if you are suffering a version of this: https://github.com/reagent-project/reagent/issues/153#issuecomment-118449228

colin.yates14:07:30

@mikethompson: Thanks Mike, however when I used figwheel it was all working, I am sure I have muffed something in boot. I will check that issue more thoroughly though

ballpark16:07:12

Hello, Newbie here. I'm trying to create a node cljs project and use boot. Any recommendations on declaring npm dependencies in boot?

ballpark16:07:12

s/declaring/getting

micha18:07:59

@ballpark: sorry i don't know about that :confused:

micha18:07:37

one thing i can recommend is to look for a lein plugin that does it (i think there is one)

micha18:07:52

you can use the functions underneath the plugin from your boot task pretty easily usually

micha18:07:15

just load the dependency via set-env! in the repl, require the namespace, and play around

micha18:07:51

not the plugin namespace, but the library stuff the plugin calls out to

ballpark18:07:28

ok. Thanks. It may turn out that I don't need it because I can just specify them in node package.json. I might look into the lein approach though. Thanks very much for your help!

micha18:07:49

if you figure it out let us know how to do it :simple_smile:

ballpark18:07:00

:simple_smile: ok. Will do

micha18:07:12

oh did yo ucheck the wiki for a boot task btw?

ballpark18:07:29

no. I just did a google search

micha18:07:37

hm doesn't appear to be anything like what yo uneed there

ballpark18:07:32

ok. Thanks again for your help!

micha20:07:58

protip of the day:

$ boot speak -t pillsbury show -f

mahinshaw20:07:51

@micha genius!

meow21:07:43

@micha: rofl

micha21:07:03

:thumbsup: