Fork me on GitHub
#boot
<
2016-12-21
>
ag01:12:09

can anyone teach me how to use crisptrutski.boot-cljs-test with om.next app? I can’t make it run tests in headless, it throws: `ReferenceError: Can't find variable: React <phantomjs://code/phantom5076976565885293384.js:81> in onError`

ag01:12:56

tried setting task options like this:

test-cljs {:js-env :phantom :optimizations :simple
             :cljs-opts {:preamble ["react/react.min.js"]
                         :externs [”react/externs/react.js"]}}
still nothing

richiardiandrea01:12:03

@ag what if you try :optimization :none or :whitespace ?

ag01:12:30

I think I get it working

ag01:12:25

I think by moving :optimizations key into :cljs-opts

ag01:12:35

of test-cljs task-options!

ag01:12:55

not sure, if that fixed it

richiardiandrea01:12:13

it would be great to uniform that, but I always check with boot task -h the options

crisptrutski08:12:00

@richiardiandrea test-cljs has :optimizations key, you linked to a subtest which just runs (the already compiled) tests

crisptrutski08:12:13

@ag sounds like you found a bug? definitely working with moved key?

jetzajac13:12:59

hello everyone! how do we move files between different filesets? say we have two tasks. each of them builds it’s own jar with different classes. each task must sift fileset to have only it’s input, produce jar and then move it to main fs. is this a way to do such things in boot BTW?

borkdude14:12:50

I have a clojurescript/node project and I’m seeing this: WARNING: Replacing ClojureScript compiler option :output-to with automatically set value. WARNING: Replacing ClojureScript compiler option :main with automatically set value. My settings:

(deftask development []
  (task-options! cljs {:optimizations :none
                       :compiler-options {:main 'reagnarok.app
                                          :target :nodejs
                                          :output-to "main.js"}
                       :source-map true
               })
  identity)

borkdude14:12:11

Why do I see these warnings?

borkdude14:12:23

Also using :optimizations :advanced cause cli arguments not to be passed to my script

borkdude14:12:54

$ node main.js foo bar
Newbie (foo bar)
<div>Hifoo</div>
$ node main.js foo bar
Newbie nil
<div>Hi</div>

borkdude15:12:18

Is there a working boot cljs node project with advanced settings I can borrow?

micha15:12:03

@borkdude you don't wnat to use :output-to, because the boot task needs to be able to set that

borkdude15:12:46

@micha is that also true for :output-dir?

micha15:12:53

also, yes

borkdude15:12:31

no problem I guess. Still wondering about the cli problem

borkdude15:12:55

I also tried: (println "argv" (.-argv js/process)), still seeing nil

richiardiandrea15:12:41

@crisptrutski oooops weird sorry

borkdude15:12:44

From #clojurescript I learned :simple is supported for node, but :advanced can cause problems.

juhoteperi15:12:37

:main is not supported because boot-cljs creates it's own namespace and sets that as :main

pesterhazy15:12:25

@borkdude also there's little need for adv compilation in node

juhoteperi15:12:32

:main might be supported in future, but it is surprisingly hard to properly support as Boot-reload/cljs-repl use cljs.edn :require: https://github.com/adzerk-oss/boot-cljs/pull/143 (ping @anmonteiro, I think you asked about this at EuroClojure)

juhoteperi15:12:21

It is easy enough to update boot-reload/cljs-repl to use :preloads but unfortunately :preloads are loaded early, and :requires after the app code has been loaded

juhoteperi15:12:02

One very easy way to support :main would be to just append that namespace to :require and still write the Boot-cljs shim namespace

anmonteiro15:12:46

@juhoteperi I'm also OK with having :main only work for release builds

anmonteiro15:12:02

(where you don't use boot-cljs-repl or boot-reload)

anmonteiro15:12:10

at least for a first attempt to making all this work

juhoteperi15:12:17

Hmm. Right. I'll think about this.

borkdude17:12:22

I would like to include Gulpfile.js from the project directory into the target directory. I tried:

(task-options!
 speak {:theme "woodblock"}
 sift {:to-asset #{"index.html" “Gulpfile.js”}})
and also :include instead of :to-asset. It only copies index.html

borkdude17:12:19

does this only work in directories?

geoffs18:12:07

@borkdude I think you would need the directory that contains Gulpfile.js to already be in the fileset before you can work with it via sift

geoffs18:12:26

i.e. you need to set that in set-env! not in task-options!. Maybe you could put your Gulpfile.js in a subdirectory and add that to the resource-paths?

iago.b2wdigital18:12:50

Quick question: I have a junit dependency under dev-dependencies but when I'm building the jar, it packs the junit jar

iago.b2wdigital18:12:11

How should I declare the dependency so it doesn't go with the final jar?

upgradingdave18:12:28

hi all, I see the wiki says that boot will work on windows 10. Just curious has anyone tried on windows 7?

micha18:12:15

@iago.b2wdigital are you making an uberjar?

micha18:12:41

you can add that dependency with :scope "test"

micha18:12:50

see boot uber -h

iago.b2wdigital18:12:56

Well I'm actually doing that

micha18:12:08

the uber task only packages dependencies with cwertain scopes

iago.b2wdigital18:12:11

The other dependencies with :scope "test" are not being packed

iago.b2wdigital18:12:17

but the junit is =/

micha18:12:36

can you do boot show -d please?

micha18:12:48

are you adding the junit dependency afte adding other dependencies?

micha18:12:08

like if you add dependencies in multiple "passes" you will run into this kind of thing

micha18:12:21

the first pass must have pulled junit in with scope compile

micha18:12:25

as a transitive dependency

micha18:12:54

the best solution is to resolve all of your dependencies in one pass

micha18:12:02

then it will do exactly what you expect

micha18:12:14

if you must use two passes you can add an :exclusion in the first pass

micha18:12:43

you can find out which things to add :exclusions to by running show -d after the first pass

micha18:12:56

and see which of your dependencies pulls junit in transitively

iago.b2wdigital18:12:46

Ok, thank you 😃

borkdude18:12:52

@geoffs moving that to resources did the trick

borkdude19:12:57

Hah, cool, I now have this workflow working: boot watches files, re-compiles cljs -> target/main.js, gulp is watching main.js, kicks of node which generates new html file with main.js, gulp reloads browser

borkdude19:12:30

I wonder if I could do this all in boot, probably

micha19:12:21

@borkdude you've seen boot-reload?

micha19:12:08

@iago.b2wdigital i don't see where you're calling set-env! multiple times?

micha19:12:15

looks like you just call it one time

micha19:12:33

which should bring in junit with the correct scope

micha19:12:43

ah i see you have aot there

micha19:12:00

which will compile anything that is transitively required by the AOT namespaces

borkdude19:12:03

@micha I’m using boot-reload in my normal cljs projects, yes. Can it reload an html file in the browser instead of hot-reloading js?

micha19:12:23

@borkdude ah of course, sorry

iago.b2wdigital19:12:38

Also, tried to remove the dep and it's still packing junit 😢

micha19:12:40

it should be reloading the html i think

iago.b2wdigital19:12:21

@micha looks like it's the [expectations "2.0.9"] calling junit lol

iago.b2wdigital19:12:43

changed the scope of expectations to test

iago.b2wdigital19:12:04

@micha just a note: expectations showed junit dependency just when I removed junit from dependencies

borkdude19:12:09

@micha It seems boot reload doesn’t pick up html changes

micha19:12:12

oh interesting

borkdude19:12:52

browserSync does a trick where it adds some code to the body tag

borkdude19:12:27

boot reload probably only appends something to browser clojurescript, which I’m not using

richiardiandrea19:12:01

@borkdude does figwheel reload the HTML?

borkdude19:12:23

I’m not sure

borkdude19:12:32

I think not

richiardiandrea19:12:05

Because I am working on importing it in boot-reload

borkdude19:12:11

Also target nodejs doesn’t mix well with boot reload.

borkdude19:12:02

I think I’m creating an edge case project here, not typical

richiardiandrea19:12:54

I am hoping to solve all these problems at the same time: https://github.com/adzerk-oss/boot-reload/pull/105

richiardiandrea19:12:18

I am going to need a mixed node +browser project as well btw so i hope to push this to completion soon

borkdude19:12:43

so this comes down to figwheel replacing the functionality in boot-reload so efforts are not duplicated?

borkdude19:12:03

that’s good to hear!

richiardiandrea19:12:37

So for instance HTML reloading could end up in figwheel directly

richiardiandrea19:12:50

I am importing the client only

richiardiandrea19:12:56

So only cljs code

richiardiandrea19:12:56

It would be great to test it as it is as well, so that I catch bugs and missing stuff early

michael.heuberger20:12:22

hello folks - we have a too big one build.boot here, getting bloated. are there any examples out there how to put each deftask in a single file somewhere else?

michael.heuberger20:12:36

some advice on that would be great

alandipert20:12:22

@michael.heuberger perhaps make a directory in your project, src/myproject/tasks.clj

alandipert20:12:38

and then in your build.boot: (require '[myproject.tasks :as t])

michael.heuberger20:12:52

thanks - is this the recommended way from the boot-clj makers?

alandipert20:12:02

yes i decree it 😄

alandipert20:12:25

the only other thing to be aware of is that in boot.user, the namespace that build.boot gets eval'd in

alandipert20:12:34

boot.core namespace is automatically refer'd

alandipert20:12:46

so you don't need to namespace-qualify e.g. deftask

alandipert20:12:30

so in your myproject.tasks ns you need this at the top:

(ns myproject.tasks
  (:require [boot.core :as core]))

(core/deftask foob ...)

alandipert20:12:44

(or whatever permutation yuo want)

michael.heuberger20:12:47

thanks guys - wow this one is a good example, nice with multimethod

richiardiandrea20:12:45

yeah I found it very useful 😄 it is similar to flavors in android projects

micha21:12:57

that's a cool thing

richiardiandrea21:12:27

also I really would like at some point to be able to avoid this -> https://github.com/Lambda-X/lambone/blob/master/resources/leiningen/new/lambone/common/dev/boot.clj#L133 so that the task can maybe get the arguments from the map under its own namespaced keyword (?) like:

(def opts {:boot.task.built-in/repl {:init-ns 'dev :port 5055}
           :boot.task.built-in/jar {:main 'data.core :file \"dada-standalone.jar\"}
           :boot.task.built-in/aot {:all true}})

(comp (aot opts) (jar opts))

richiardiandrea21:12:41

oh man, formatting lol

richiardiandrea21:12:31

of course maybe with aliases to reduce verbosity

richiardiandrea21:12:03

it is a simple convention but I found it very powerful

micha21:12:57

looks like a little higher order function could work there

micha21:12:15

(comp (f aot opts) (f jar opts))

richiardiandrea22:12:59

Yes but baked would be nicer 😀 if you like the idea of course boot-clj 😅

alandipert22:12:52

you could say he's "partial" to higher order functions 😁

ag22:12:43

can I run “boot_cljs_test" for only specific test only?