Fork me on GitHub
#figwheel-main
<
2019-01-04
>
tianshu08:01:10

Is the directory name cljs-out can be changed in figwheel-main config?

kwladyka09:01:05

@doglooksgood I didn’t try but it is probably :output-dir for compiler options. I don’t know if you use cljs / lein / boot so you have to check yourself how to set it

tianshu09:01:22

I'm using clojure-cli. I found this :target-dir, but the :output-dir and output-to is composed by this target-dir and some fixed strings. I want my develop build and production build use the same path so that I can write <script src="js/main.js"></script> in my html file.

tianshu09:01:01

so how do you handle with this problem? @kwladyka

kwladyka09:01:07

Personally I use standard cljs-out directory and I don’t have any issue about that

kwladyka09:01:15

But I am sure you can set different name

kwladyka09:01:49

But it looks like with :output-dir and :target-dir you should be able to change the name

kwladyka09:01:26

You can use dev.cljs.edn or figwheel-main.edn for that purpose

kwladyka09:01:04

I have to go buy bread for breakfast 🍞

tianshu09:01:52

Okay, thank you! have a nice day sir!

zyxmn17:01:58

I am currently struggling with this problem https://github.com/tpope/vim-fireplace/issues/303 . I have posted this on the vim channel but I thought i might try my luck here aswell.

dnolen19:01:50

can figwheel watch/reload index.html?

kwladyka19:01:24

@dnolen https://github.com/kwladyka/form-validator-cljs/blob/doc/dev.cljs.edn#L2 you can watch whatever dirs you want. Event outside project. But reload can be more tricky. At least it doesn’t work by default for index.html.

dnolen19:01:37

hrm yeah, would be useful in a non-React context where you're just building a very simple site

kwladyka19:01:40

maybe location.reload(); with figwheel reload event?

kwladyka19:01:18

I didn’t try but it should work

dnolen19:01:09

oh yeah right

dnolen19:01:20

@kwladyka actually, probably not what I want, I only want to reload the window if and only if index.html actually changed

kwladyka19:01:55

@dnolen no reload if CSS or other files change? only index.html?

kwladyka20:01:08

you could try put index.html into folder containing only this files resources/public/foo/index.html and set it with :watch-dir. In index.html load files with ../ but not sure it is what you want

kwladyka20:01:23

@dnolen if you are doing something simple and static (without cljs compilation) you can try Visual Studio Code + https://marketplace.visualstudio.com/items?itemName=Flixs.vs-code-http-server-and-html-preview - live preview on one file / or directory depend what you choose

richiardiandrea20:01:24

Hello folks and happy new year 😄 I am trying to compile a node project but

richiardiandrea20:01:27

[Figwheel] Failed to compile build test in 0.218 seconds.
[Figwheel:WARNING] Compile Exception: contains? not supported on type: java.lang.Boolean  
[Figwheel:SEVERE] java.lang.IllegalArgumentException: contains? not supported on type: java.lang.Boolean
[Figwheel:FINEST] Figwheel.core config: {}

richiardiandrea20:01:42

what can be the reason?

kwladyka20:01:36

no idea, try to comment “half a code”, if no bug, uncomment half of this half and you will finally find this line 🙂

richiardiandrea20:01:04

yeah that is what I am doing, but it is a brand new project

richiardiandrea20:01:15

so it has very few things that can go wrong 😄 maybe

kwladyka20:01:18

but it looks like config issue after your edit

richiardiandrea20:01:47

I have this:

^{:watch-dirs ["src" "dev"]
  :log-level :all
  :log-syntax-error-style :verbose
  :auto-testing true
  :extra-main-files {:tests {:main promotion.test.runner}}}
{:optimizations :none
 :main promotion.test.runner
 :output-dir ".cljs"
 :output-to ".cljs/test.js"
 :source-map true
 :source-map-timestamp false
 :target :nodejs
 :install-deps true
 :closure-defines {promotion.test.test-preload.COLORS true}
 :preloads [promotion.test.test-preload]}

richiardiandrea20:01:39

and:

(ns promotion.test.runner
  (:require [cljs-test-display.core :as test-display]
            [cljs.test :as test :include-macros true]
            ;; require all the namespaces that have tests in them
            [promotion.test.campaing-test]))

(test/run-tests (test-display/init! "testing-div")
                'promotion.test.campaign-test)

richiardiandrea20:01:14

I am using clojure 1.10.0 let me try to downgrade

kwladyka20:01:53

:closure-defines {promotion.test.test-preload.COLORS true} I am not sure but try :closure-defines {promotion.test.test-preload/COLORS true} instead

richiardiandrea20:01:34

nope but nice catch

kwladyka20:01:59

try with comment half of a config then 😉

kwladyka20:01:16

I don’t have any other ideas, sorry

richiardiandrea20:01:30

it looks like I have to put the deps to clojure in :deps rather than in my :dev alias

richiardiandrea20:01:22

this things always buffle me, still classpath dependency problems after > 5 years of Clojure lol

kwladyka20:01:01

Did you use template to create fighweel-main project?

richiardiandrea20:01:32

well I thought I could figure it out 😉

kwladyka20:01:41

I recommend to do it 😉

kwladyka20:01:30

IMO it is right way to use it

richiardiandrea20:01:34

that's similar to what I have now

richiardiandrea21:01:09

h well, I saw it working once, now failing again lol

richiardiandrea21:01:44

now that it is working, I am going to ...should I see the tests from cljs-test-display there?

richiardiandrea21:01:39

it looks like the html include the bash preamble:

<script type="text/javascript">#!/usr/bin/env node
if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) {
    Math.imul = function (a, b) {
        var ah  = (a >>> 16) & 0xffff;
        var al = a & 0xffff;
        var bh  = (b >>> 16) & 0xffff;
        var bl = b & 0xffff;
        // the shift by 0 fixes the sign on the high part
        // the final |0 converts the unsigned value into a signed value
        return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
    }
}

richiardiandrea22:01:26

Am I misconfiguring something? Does :extra-main works with node targets?

bhauman22:01:46

@dnolen there is a fairly straightforward pattern where you can add watcher and eval javascript on the client side https://github.com/bhauman/figwheel-main/blob/master/src/figwheel/main/css_reload.cljc

bhauman22:01:06

just need to add the namespace as a preload

bhauman22:01:30

ah shoot its more complicated than that

richiardiandrea22:01:59

@bhauman the above - is it never going to work or it requires tweaking only?

bhauman22:01:24

so cljs-test-display always runs in the browser

bhauman22:01:47

so if your tests are cross platform, you can probably rig it

richiardiandrea22:01:07

I though a layer would exec the tests server side (in the node process) and only the results would be sent

richiardiandrea22:01:12

kk cool thank you