figwheel-main

figwheel-main http://figwheel.org
john 2020-09-30T22:42:12.020800Z

I'd like to run some clojure code, from within the src code dir of a project, where I can get to the contents of :external-config (or some place to store a configurable var) in that clojure ns, and then shell out to cli commands that depend on the configuration vars. Do I have to handle launching the figwheel/cljs compiler manually in order to get at the env on the clojure side? Or can I get to it by requiring some things? I basically just need to be able to get some project-wide conf data from both clojure and clojurescript

lispers-anonymous 2020-10-01T14:50:56.026300Z

Hell yeah. I'm glad it worked because I did not try it myself lol

john 2020-09-30T22:44:40.022900Z

Almost like just a custom plugin I can conditionally run before everything runs, to help set up other services. Any recommendations for how to go about that? Should I just drop the shell-outs in the user ns or is there a way to call a src file on the classpath as a preload?

john 2020-09-30T22:47:39.024200Z

Being able to add a shell command directly the deps.edn or figwheel's dev.cljs.edn, that gets called in addition to the main, would suffice I think

lispers-anonymous 2020-09-30T23:47:40.024300Z

The way I would think you have to do it is to start figwheel manually. I don't know of any pre-run hooks available to help. I'd try something like this:

(ns my-ns (:require [figwheel.main]))
(defn -main
  []
  (setup-your-stuff)
  (figwheel.main/start :dev))
And then start with clj -m my-ns

john 2020-09-30T23:48:58.024500Z

Makes sense. Thanks @dannyfreeman!