Clojurians
#boot
<
2016-05-09
>

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

ag17:05:43

can anyone tell me how can I add npm dependencies in clj.boot project. for lein there’s lein-npm plugin, I’m thinking about switching to boot.

martinklepsch18:05:37

some time ago something like boot -d aleph show -d would print the dependency graph for aleph but that's no longer the case — bug or feature? :simple_smile:

martinklepsch18:05:19

but it seems like no one has worked on an npm task yet

martinklepsch18:05:40

maybe webjars could be an alternative for you? I know some people are using that

ag18:05:47

not really, I need to consume npm packages. basically do exactly what lein-npm plugin does

martinklepsch18:05:09

Ah, this still works: boot -d aleph:0.4.2-alpha3 show -d

richiardiandrea20:05:52

Is it normal that it takes 27 seconds to compile a simple, one page app with boot-cljs-reload?

micha20:05:18

optimizations?

micha20:05:00

@martinklepsch: that looks like a bug!

richiardiandrea21:05:05

optimizations :simple

richiardiandrea21:05:39

the thing I am doing is to require and resolve in the task, can this be a problem?

richiardiandrea21:05:09

also cljs-repl is inside the watch chain, maybe I should remove it

richiardiandrea21:05:59

Elapsed time: 15.669 sec with a mere:

(ns acu.app)

(enable-console-print!)

(defn init []
 )

micha21:05:55

@richiardiandrea: there is an option you can provide to the cljs compiler to have it log elapsed times

micha21:05:04

so you can see where time is being spent

richiardiandrea21:05:16

oh, let me check that :smile:

richiardiandrea21:05:56

:compiler-stats true

richiardiandrea21:05:28

Maybe :source is too for real time dev:

Compile sources, elapsed time: 172.601627 msecs
Optimizing 152 sources, elapsed time: 25283.938144 msecs
Writing target dir(s)...
Elapsed time: 25.930 sec

micha21:05:06

it is also saying 152 sources

micha21:05:14

not just the one cljs file you have above

richiardiandrea21:05:42

I guess those are the dependencies I am requiring (I removed them when I showed you)

micha21:05:38

yeah it should only compile things you will actually use in your application

micha21:05:50

(plus transitive :requires of course)

juhoteperi21:05:55

optimisations simple is the problem

richiardiandrea21:05:25

yes @juhoteperi I was trying that now, it is weird, I inherited this project and it was :simple...maybe they were not using reloading at all

micha21:05:30

also stuff like boot-reload aren't designed to work with optimizations on, so you might see weird things with :simple .

richiardiandrea21:05:57

thanks guys and sorry for the noise

richiardiandrea21:05:08

with :none of course:

Compiling ClojureScript...
• main.js
Compile sources, elapsed time: 137.64036 msecs
Writing target dir(s)...
Elapsed time: 0.641 sec

ivanreese22:05:12

Is that typical of the time you'd get from a cold boot? (No pun intended)

ivanreese22:05:02

I'm a lein user strongly considering switching. Knowing that boot managed to somehow shorten the time it takes to go from $ to a running CLJS app would really cinch it for me.

micha22:05:38

that looks like the time for an incremental compile

micha23:05:07

probably around 8 sec or so from the $ prompt

ivanreese23:05:16

So about the same. Hmm.

ivanreese23:05:52

I wonder if anyone has figured out a good story for using CLJS to compile CLJS, so you can skip the JVM startup..

micha23:05:10

yeah i'd be interested in using that too

ivanreese23:05:16

(I'm aware of bootstrapping, haha.. I just mean.. within the context of a boot project or a lein project)

micha23:05:25

i'd like to be able to write cljs macros in cljs

micha23:05:44

and use nashorn or something to compile the cljs

micha23:05:04

yeah or node, but nashorn seems cleaner

ivanreese23:05:13

But.. dat JVM startup time!

micha23:05:33

yeah bummer

micha23:05:45

clojure compiler is not the fastest

micha23:05:00

but you don't need to restart boot that often

micha23:05:07

so you can amortize the cost

ivanreese23:05:42

Except when you're trying to debug build config issues.

micha23:05:54

well boot definitely helps you there

micha23:05:03

the boot cljs task has very few options

micha23:05:11

it can figure most of it out on its own

micha23:05:24

like with boot-cljs if something isn't working just remove all your options

micha23:05:30

and it will probably be fine

micha23:05:00

i never use any options with cljs task, except for :optimizations when i want to compile for prod

ivanreese23:05:35

I have an issue in my current project (which uses lein) where source maps aren't working in Safari or Firefox, but they are working in Chrome. I haven't had this problem in any of my CoffeeScript projects, so I suspect I might have misconfigured lein somehow. But debugging that... means I hit the JVM startup penalty every time. Do you know if boot-cljs does any better with source maps in non-Chrome browsers?

ivanreese23:05:48

Or is that the sort of thing I'll just need to find out by testing it myself :wink: ?

micha23:05:51

that's all automatic with boot

micha23:05:55

you don't configure that

micha23:05:29

really the only thing you need to specify is :optimizations if you don't want :none

micha23:05:39

everything else is handled automatically

micha23:05:03

the live reload and brepl tasks are completely separate

micha23:05:45

of course if you have a unique situation like you're compiling in 10 docker containers on a vpn in china or something you will need to play with it

micha23:05:57

but i would say just don't do that

ivanreese23:05:01

I hope to never have such a unique situation.

micha23:05:08

no need to get fancy with dev builds imho

ivanreese23:05:19

Solid. Thanks for the info.

micha23:05:11

the modern cljs tutorials are really good for getting started with boot for cljs

micha23:05:18

covers pretty much the whole thing

ivanreese23:05:30

Is that the tut in linked from the CLJS github wiki?

micha23:05:54

yep that's the one

micha23:05:17

it covers everything you want probably

micha23:05:28

like tests, dev servers, things like that

ivanreese23:05:35

This looks great, and should help get me past my project config woes and get me up and running on boot in one step.

micha23:05:11

yeah the one thing i recommend is going as far as you can with no options to cljs task

micha23:05:34

i mean without using the :compiler-options option

micha23:05:59

the cljs task should get you a usable setup on its own