Fork me on GitHub
Adriaan Callaerts15:07:44

hi everyone! I'm running devcards as an extra-main using figwheel main. The entrypoint seems to be imported fine and devcard ui is showing, but none of my cards are being shown. Anyone have any clue what might be going wrong?


Have you done a require of your test namespaces in your runner?


It doesn't automagically find them like the auto testing runner does, in my experience

Adriaan Callaerts15:07:22

yes, I've done a require. It seems like the macro is not getting expanded into a card/is being removed

Adriaan Callaerts15:07:33

ok, figured it out. The figwheel extra-main-files gave me the impression that the map for an extra entry would get merged with the settings for the main entry. So I thought I could do this:

^{:watch-dirs ["src" "env/dev" "cards" "test"]
  :auto-bundle :webpack
  :final-output-to "resources/public/js/app.js"
  :clean-outputs true
  {:devcards {:main frontend.devcards-runner
              :devcards true}}}
{:main frontend.main
 :output-dir "resources/public/js/app"
 :output-wrapper true}
which apparently you can't. If I specify the :devcards true setting in the main map it works


but its true


its in the docs


maybe I need to raise it to the top in a tdlr section


Also I’m hoping to have a :auto-devcards figwheel option soon

👍 6
Adriaan Callaerts15:07:32

Another thing that I noticed using it with figwheel main is that I kinda have to do something hacky to get it to play nice with the generated entrypoint. I wanted to achieve a similar effect as the auto-testing, in which the UI of the testing/devcards report overrides/replaces the dummy output of the extra-main html. To achieve that with devcards, I resorted to doing something like this:

(ns fleet-frontend.devcards-runner
  (:require [devcards.core]
            [devcards.system :refer [devcards-app-element-id get-element-by-id]]

(defonce init
    (println "Devcards are ON")
    (set! (. (get-element-by-id "app-devcards") -id) devcards-app-element-id)


yeah you are better off creating a landing html page that requires the devcards-runner.main.js

Adriaan Callaerts15:07:06

how does figwheel achieve that effect with the testing report? I'm guessing it overrides the goog-define for the root element id that's used there?


it uses the app element that is already there I think

Adriaan Callaerts15:07:06

wouldn't the app element be called app-auto-testing?


yeah your right

Adriaan Callaerts15:07:28

so I'm guessing figwheel does some magic to "set" this to use the alternative mount point, as opposed to devcard which has it hardcoded here


yeah a closure define can set that


there it is