     (apply-to-key namify-module-entries :modules)
     (apply-to-key name :main)))
 
-(defn ensure-id [opts]
-  (if (nil? (:id opts))
-    (assoc opts :id (name (gensym "build_needs_id_")))
-    (assoc opts :id (name (:id opts)))))
-
 (defn move-compiler-to-build-options [build]
-  (if (and (not (:build-options build))
-           (:compiler build))
-    (-> build
-      (assoc :build-options (:compiler build))
-      (dissoc :compiler))
-    build))
-
-(defn fix-build [build]
   (-> build
-    ensure-id
-    move-compiler-to-build-options
-    (update-in [:build-options] fix-build-options)))
-
-(defn fix-builds [builds]
-  (mapv fix-build builds))
-
-(defn no-seqs [b]
-  (walk/postwalk #(if (seq? %) (vec %) %) b))
-
-(defn ensure-output-dirs [builds]
-  (mapv ensure-output-dirs* builds)
-  builds)
-
-(defn figwheel-client-options [{:keys [figwheel]}]
-  (if figwheel
-    (if-not (map? figwheel) {} figwheel)
-    {}))
-
-(comment
-  (figwheel-client-options {:figwheel {:hey 1}})
-
-  (figwheel-client-options {:figwheel true})
-  
-  )
-
-(defn fix-figwheel-symbol-keys [figwheel]
-  (into {} (map (fn [[k v]] [k (if (symbol? v) (name v) v)]) figwheel)))
-
-(defn append-build-id [figwheel build]
-  (if (:id build)
-    (assoc figwheel :build-id (:id build))
-    figwheel))
-
-(defn forward-devcard-option [{:keys [figwheel] :as build}]
-  (if (and figwheel (:devcards figwheel))
-    (assoc-in build [:build-options :devcards] true)
-    build))
-
-(defn prep-build-for-figwheel-client [{:keys [figwheel] :as build}]
-  (if figwheel
-    (assoc build :figwheel
-           (-> (figwheel-client-options build)
-             (append-build-id build)
-             (fix-figwheel-symbol-keys)))
-    build))
-
-(defn prep-builds-for-figwheel-client [builds]
-  (mapv (comp prep-build-for-figwheel-client forward-devcard-option) builds))
-
-(defn figwheel-build? [build]
-  (and (= (get-in build [:build-options :optimizations]) :none)
-       (:figwheel build)))
+      (assoc :build-options (get-build-options build))
+      (dissoc :compiler)))
+
+(defn ensure-id
+  "Converts given build :id to a string and if no :id exists generate and id."
+  [opts]
+  (assoc opts
+         :id (name (or
+                    (:id opts)
+                    (gensym "build_needs_id_")))))
+
+(defn prep-build [build]
+  (-> build
+      (dissoc :warning-handlers)
+      ensure-id
+      move-compiler-to-build-options
+      (update-in [:build-options] fix-build-options)
+      prep-build-for-figwheel-client
+      forward-devcard-option
+      ensure-output-dirs!
+      no-seqs
+      (vary-meta assoc ::prepped true)))
+
+(defn prepped? [build]
+  (-> build meta ::prepped))
 
 (defn update-figwheel-connect-options [figwheel-server build]
   (if (figwheel-build? build)

                  module-map))
    module-map))

(defn opt-none? [{:keys [optimizations]}]
  (or (nil? optimizations) (= optimizations :none)))

;; TODO this is a hack need to check all the places that I'm checking for
;; :optimizations :none and check for nil? or :none
(defn default-optimizations-to-none [build-options]
  (if (opt-none? build-options)
    (assoc build-options :optimizations :none)
    build-options))


(defn prep-builds [builds]
  (-> builds
      map-to-vec-builds
      (->> (mapv prep-build))))

(defn prep-options
  "Normalize various configuration input."
