Permalink
Browse files

Get uberjar build working locally - still duplicate compilation steps

  • Loading branch information...
jraines committed Nov 6, 2015
1 parent c1a4f9c commit ea94287bb9acf6057273ae6db5c58ac6d06cb4b2
Showing with 66 additions and 54 deletions.
  1. +1 −0 .gitignore
  2. 0 {src → dev}/simoutfit/cards.cljs
  3. +1 −18 dev/user.clj
  4. +45 −34 project.clj
  5. +19 −2 src/simoutfit/server.clj
View
@@ -13,3 +13,4 @@ pom.xml
.nrepl-port
*.sqlite
id_rsa
.lein-env
File renamed without changes.
View
@@ -1,6 +1,5 @@
(ns user
(:require [figwheel-sidecar.repl-api :refer [cljs-repl]]
[ragtime.jdbc :as jdbc]
(:require [ragtime.jdbc :as jdbc]
[ragtime.repl :as rtr]))
(defn load-config []
@@ -15,19 +14,3 @@
(defn rollback []
(println "rolling back last migration")
(rtr/rollback (load-config)))
;; (ns user
;; (:require [com.stuartsierra.component :as component]
;; [figwheel-sidecar.system :as sys]))
;; (def system
;; (component/system-map
;; :figwheel-system (sys/figwheel-system (sys/fetch-config))))
;; (defn fig []
;; (alter-var-root #'system component/start)
;; (sys/build-switching-cljs-repl (:figwheel-system system)))
;; (println "use (fig) to start figwheel repl")
View
@@ -9,39 +9,68 @@
[compojure "1.4.0"]
[http-kit "2.1.19"]
[ring/ring-core "1.4.0"]
[ring/ring-devel "1.4.0"]
[environ "1.0.1"]
[ring-transit "0.1.4"]
[org.omcljs/om "1.0.0-alpha14"]
[com.cognitect/transit-clj "0.8.285"]
[com.cognitect/transit-cljs "0.8.225"]
[figwheel "0.5.0-SNAPSHOT"]
[devcards "0.2.0-8"]
[yesql "0.5.1"]
[ragtime "0.5.2"]
[org.postgresql/postgresql "9.4-1201-jdbc41"]
[figwheel-sidecar "0.5.0-SNAPSHOT"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]]
:plugins [[lein-cljsbuild "1.1.0"]
:plugins [[lein-environ "1.0.1"]
[lein-cljsbuild "1.1.0"]
[lein-figwheel "0.5.0-SNAPSHOT"]]
:source-paths ["src" "dev"]
:aliases {"migrate" ["run" "-m" "user/migrate"]
"rollback" ["run" "-m" "user/rollback"]}
:profiles {:repl {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}
:dev {:dependencies [[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]
]
:profiles {
:dev {:env {:environment "dev"}
:dependencies [[ring/ring-devel "1.4.0"]
[figwheel-sidecar "0.5.0-SNAPSHOT"]
[figwheel "0.5.0-SNAPSHOT"]
[devcards "0.2.0-8"]
[com.cemerick/piggieback "0.2.1"]
[org.clojure/tools.nrepl "0.2.12"]]
:plugins [[mvxcvi/whidbey "1.3.0"]]
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}
:uberjar {
;this runs the first entry in the cljsbuils :builds map below
:prep-tasks ["compile" ["cljsbuild" "once"]]
:env {:environment "production"}
:main simoutfit.server
:aot :all
:source-paths ["src"]
:omit-source true
;:cljsbuild {
;:builds [{:source-paths ["src"]
;:compiler {:output-to "resources/public/js/compiled/simoutfit.js"
;:main simoutfit.core
;:jar true
;:optimizations :advanced
;:pretty-print false} }]
;}
}}
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
:cljsbuild {
:builds [{:id "dev"
:builds [
{:id "min"
:source-paths ["src"]
:compiler {:output-to "resources/public/js/compiled/simoutfit.js"
:main simoutfit.core
:optimizations :advanced
:pretty-print false}}
{:id "dev"
:source-paths ["src" "dev"]
:figwheel { :on-jsload "simoutfit.core/on-js-reload" }
@@ -50,14 +79,9 @@
:output-to "resources/public/js/compiled/simoutfit.js"
:output-dir "resources/public/js/compiled/out"
:source-map-timestamp true }}
{:id "min"
:source-paths ["src"]
:compiler {:output-to "resources/public/js/compiled/simoutfit.js"
:main simoutfit.core
:optimizations :advanced
:pretty-print false}}
{:id "devcards"
:source-paths ["src"]
:source-paths ["src" "dev"]
:figwheel { :devcards true } ;; <- note this
:compiler { :main simoutfit.cards
:asset-path "js/compiled/devcards_out"
@@ -66,33 +90,20 @@
:source-map-timestamp true }}]}
:figwheel {
;; :http-server-root "public" ;; default and assumes "resources"
;; :http-server-root "public" ;; default and assumes "resources"
;; :server-port 3449 ;; default
;; :server-ip "127.0.0.1"
;; :server-ip "127.0.0.1"
:css-dirs ["resources/public/css"] ;; watch and update CSS
;; Start an nREPL server into the running figwheel process
:nrepl-port 7888
;; Server Ring Handler (optional)
;; if you want to embed a ring handler into the figwheel http-kit
;; server, this is for simple ring servers, if this
;; doesn't work for you just run your own server :)
;; :ring-handler hello_world.server/handler
;; To be able to open files in your editor from the heads up display
;; you will need to put a script on your path.
;; that script will have to take a file path and a line number
;; ie. in ~/bin/myfile-opener
;; #! /bin/sh
;; emacsclient -n +$2 $1
;;
;; :open-file-command "myfile-opener"
;; if you want to disable the REPL
;; :repl false
;; to configure a different figwheel logfile path
;; :server-logfile "tmp/logs/figwheel-logfile.log"
;; :server-logfile "tmp/logs/figwheel-logfile.log"
})
View
@@ -1,13 +1,20 @@
(ns simoutfit.server
(:gen-class)
(:require [compojure.core :refer :all]
[compojure.route :as route]
[ring.middleware.transit :refer [wrap-transit-params]]
[ring.middleware.reload :refer [wrap-reload]]
[cognitect.transit :as t]
[environ.core :refer [env]]
[om.next.server :as om]
[org.httpkit.server :refer [run-server]])
(:import [java.io ByteArrayOutputStream]))
(if (= (env :environment) "dev")
(require '[ring.middleware.reload :refer [wrap-reload]]))
(if (= (env :environment) "dev")
(defn wrap-reload [req] false))
(defn write [x]
(let [baos (ByteArrayOutputStream.)
w (t/writer baos :json)
@@ -46,9 +53,19 @@
(route/resources "/")
(POST "/api" params api))
(defn -main []
(defn start-dev-server []
(run-server (-> app
wrap-transit-params
wrap-reload)
{:port 5000}))
(defn start-prod-server []
(run-server (-> app
wrap-transit-params)
{:port 5000}))
(defn -main []
(if (= (env :environment) "dev")
(start-dev-server)
(start-prod-server)))

0 comments on commit ea94287

Please sign in to comment.