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.
Re: passing messages other than files and their content, it's worth noting that FileSets and the things in them (TmpFiles) can carry metadata. So, tasks can add non-file info to the FileSet by adding metadata to things. This is the direction we want to go in boot with accumulating error messages and warnings.
I didn't mean for anything to sound too crazy and I probably shouldn't have even mentioned the word monad 😺 I also totally see the familiarity and utility inherent in a messaging approach. I suppose I just feel that if tools were to share only one thing, in my mind an immutable data structure is a good bet.