     (assoc opts :id (name (gensym "build_needs_id_")))
     (assoc opts :id (name (:id opts)))))
 
-(defn fix-build [opts]
-  (-> 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
-    (update-in [(if (:build-options opts) :build-options :compiler)] fix-build-options)))
+    move-compiler-to-build-options
+    (update-in [:build-options] fix-build-options)))
 
 (defn fix-builds [builds]
   (mapv fix-build builds))

(defn optimizations-none?
  "returns true if a build has :optimizations set to :none"
  [build]
  (= :none (get-in build [:compiler :optimizations])))

;; checking to see if output dir is in right directory
(defn norm-path

      options)))

(comment
  (default-optimizations-to-none {:optimizations :simple})
  
  (sane-output-to-dir {:output-dir "yes" })

  (sane-output-to-dir {:output-to "yes.js"})

  (sane-output-to-dir {:output-dir "yes/there"})

  (sane-output-to-dir {:output-to "outer/yes.js"})
  )

(defn fix-build-options [build-options]
  (->> build-options
    (default-optimizations-to-none)
    (apply-to-key normalize-dir :output-dir)
    (sane-output-to-dir)
    (apply-to-key namify-module-entries :modules)
