There is a need more complex build scripts for ClojureScript. It would be nice to have a minmal interface and method for composing these scripts. Somehting like:
(-> (watch-cljs ["src"])
(watch-sass [""])
(compile-sass)
(watch-css [""])
(mark-macro-affected-source build-options)
(compile-cljs build-options)
(cljs-browser-repl)
#_(fighweel-browser-connection)
#_(figwheel-browser-repl)
(ambly-repl))
It is not lost on me that this is similar to what boot currently does. I have nothing against Boot, it would just be nice to have something that was neither tied to lein or boot that allows us to create and share building tools.
This system would not require buy-in just adhearance to a simple interface.
What should this interface look like?
Right now I'm leaning towards a ring-like functional interace where individual components can use core.async or other methods to handle the nastiness of this type of async build work.
Things to consider.
-
It would be nice to be able to create these composable flows and perhaps explicitely start and stop them.
-
I am also leaning toward a message based flow. Where the current component either recieves and operates on the message eventually forwarding it or passes it on untouched.
Tiny example:
(defn compile-cljs [source-paths build-options]
(fn [f]
(fn [signal]
(f (if (= [:cljs-changed] signal)
(do (cljs.build.api/build source-paths build-options)
[:cljs.build/cljs-compiled {:data ...}])
signal)))))
I'm just putting this out there. This idea has been in my head for a year and I'd like to break figwheel down into parts that can be more easily reused.
I like the way it reads.
My first thought is a question on how the outputs of one step are fed into the next. Take a look at the Automator app that comes with OS X. Each step has an input and a result which determines legal ways of composing things.
I have no experience with Boot. (And suspect that the issue I mention above is sorted in that system.)
The message chain idea is interesting as well.
I suppose that you are right in that it would work if there is a Ring-like spec.
Cool idea. I need to let it soak. But I definitely see the gem buried in it. Composing FTW!