 (ns figwheel-sidecar.config
   (:require
    [clojure.string :as string]
-   [clojure.java.io :as io]))
+   [clojure.java.io :as io]
+   [clojure.walk :as walk]))
 
 (defn optimizations-none?
   "returns true if a build has :optimizations set to :none"

  "Normalize various configuration input."
  [opts]
  (->> opts
       (apply-to-key str :ring-handler)
       (apply-to-key vec :css-dirs)
       (apply-to-key vec :resource-paths)))


    dir))

(defn normalize-output-dir [opts]
  (update-in opts [(if (:build-options opts) :build-options :compiler)  :output-dir] normalize-dir))

(defn normalize-output-dirs [builds]
  (mapv normalize-output-dir builds))

(defn no-seqs [b]
  (walk/postwalk #(if (seq? %) (vec %) %) b))

(defn prep-builds [builds]
  (-> builds
      map-to-vec-builds
      normalize-output-dirs
      no-seqs))

(defn apply-to-key
  "applies a function to a key, if key is defined."
