Skip to content

Instantly share code, notes, and snippets.

@pvik pvik/build.boot
Created Jun 10, 2019

Embed
What would you like to do?
(set-env!
:source-paths #{"src/scss" "src/clj" "src/cljs" "src/cljc"}
:resource-paths #{"html" "resources"}
:dependencies '[[org.clojure/clojure "1.10.1"]
[org.clojure/clojurescript "1.10.520"]
;; server
[compojure "1.6.1"]
[ring/ring-core "1.7.1"]
[ring/ring-jetty-adapter "1.7.1"]
[ring/ring-json "0.4.0"]
[ring-middleware-format "0.7.4"]
;; [javax.servlet/servlet-api "2.5" :scope "test"]
;; [yogthos/config "1.1.1"]
;; java 10 upgrade
[javax.xml.bind/jaxb-api "2.4.0-b180830.0359"]
;; common
[org.clojure/core.async "0.4.490"]
[org.clojars.akiel/async-error "0.3"]
[hickory "0.7.1"]
[instaparse "1.4.10"]
;; clj
[clj-time "0.15.1"]
[clj-http "3.10.0"]
[clout "2.2.1"]
[org.clojure/data.json "0.2.6"]
[org.clojure/data.codec "0.1.1"] ;; Base64
;; cljs
[com.andrewmcveigh/cljs-time "0.5.2"]
[prismatic/dommy "1.1.0"]
[hipo "0.5.2"]
[hodgepodge "0.1.3"]
[cljs-http "0.1.46"]
[com.cemerick/url "0.1.1"]
[reagent "0.8.1"]
[alandipert/storage-atom "2.0.1"]
;; db
[ragtime "0.8.0"] ;; Migrations
[hikari-cp "2.7.1"] ;; Connection Pooling
[org.clojure/java.jdbc "0.7.9"]
[honeysql "0.9.4"]
[org.postgresql/postgresql "42.2.5"]
;; Authentication framework with JWT
[buddy/buddy-auth "2.1.0"]
[buddy/buddy-core "1.5.0"]
[buddy/buddy-sign "3.0.0"]
;; argon2 for password hashing
[de.mkammerer/argon2-jvm "2.5"]
;; ldap
[org.clojars.pntblnk/clj-ldap "0.0.16"]
;; email
[com.draines/postal "2.0.3"]
;; notification templates
[cljstache "2.0.1"]
;; logging
[com.taoensso/timbre "4.10.0"] ;; logging
[com.fzakaria/slf4j-timbre "0.3.13"]
[org.slf4j/log4j-over-slf4j "1.7.26"]
[org.slf4j/jul-to-slf4j "1.7.26"]
[org.slf4j/jcl-over-slf4j "1.7.26"]
;; spec , test & gen
[org.clojure/test.check "0.9.0" :scope "test"]
;; Dependencies for build process
[adzerk/boot-cljs "2.1.5" :scope "test"]
[adzerk/boot-test "1.2.0" :scope "test"]
[pandeiro/boot-http "0.8.3" :scope "test"]
[adzerk/boot-reload "0.6.0" :scope "test"]
[adzerk/boot-cljs-repl "0.4.0" :scope "test"]
[mbuczko/boot-ragtime "0.3.1" :scope "test"]
[deraen/boot-sass "0.3.1" :scope "test"]
[tolitius/boot-check "0.1.12" :scope "test"]
;; [samestep/boot-refresh "0.1.0" :scope "test"]
]
:db-opts (:db (clojure.edn/read-string (slurp "resources/config.edn"))))
(require '[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-test :refer :all]
'[mbuczko.boot-ragtime :refer [ragtime]]
'[deraen.boot-sass :refer [sass]]
'[tolitius.boot-check :as check]
;; '[samestep.boot-refresh :refer [refresh]]
)
(task-options!
pom {:project 'myapp
:version "0.1"}
cljs {:optimizations :none}
ragtime {:database (str "jdbc:"
(:dbtype (get-env :db-opts)) "://"
(:user (get-env :db-opts)) ":"
(:password (get-env :db-opts)) "@"
(:host (get-env :db-opts)) ":"
(:port (get-env :db-opts)) "/"
(:dbname (get-env :db-opts)))}
test {:include #"myapp.test"
:junit-output-to "junit-out"})
(deftask add-cljs-dev-deps []
(merge-env! :dependencies
'[[cider/piggieback "0.4.1" :scope "test"]
[nrepl "0.6.0" :scope "test"]
;; [com.cemerick/piggieback "0.2.2" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/tools.nrepl "0.2.13" :scope "test"]])
identity)
(deftask dev
"Launch Immediate Feedback Development Environment"
[]
(require '[adzerk.boot-reload]
'[pandeiro.boot-http]
'[adzerk.boot-cljs-repl])
(let [reload (resolve 'adzerk.boot-reload/reload)
serve (resolve 'pandeiro.boot-http/serve)
cljs-repl (resolve 'adzerk.boot-cljs-repl/cljs-repl)
start-repl (resolve 'adzerk.boot-cljs-repl/start-repl)]
(comp
(add-cljs-dev-deps)
(serve :handler 'myapp.core/app ;; ring handler
:resource-root "public" ;; root classpath
:port 3500
:reload true) ;; reload ns
(watch)
(reload)
(cljs-repl) ;; before cljs task
(cljs :source-map true :optimizations :none)
(sass)
(target :dir #{"public"}))))
(deftask build
"Builds an uberjar of this project that can be run with java -jar"
[]
(comp
(aot :all true) ;; :namespace #{'myapp.server}
(pom)
(cljs :optimizations :advanced
:compiler-options {:optimizations :advanced})
(sass)
(sift :move {#"(.*)js$" "public/$1js"
#"(.*)html$" "public/$1html"
#"css/(.*)" "public/css/$1"})
(uber :exclude-scope #{"test"})
(jar :file "myapp.jar" :main 'myapp.server )
(sift :include #{#"myapp.jar"})
(target)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.