Skip to content

Commit

Permalink
Improve developer experience in README and project.clj
Browse files Browse the repository at this point in the history
Replace re-frisk with re-frame-10x, add cljfmt and lein aliases.
  • Loading branch information
heralden committed Oct 14, 2019
1 parent 3ef8026 commit f40b285
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 50 deletions.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ You will often see location passed to the outermost function, but don't be caugh

When a table first loads it only renders the first page of the query results as bog standard html with minimal components. This allows many tables to be rendered to, say, a report page while reducing load on the browser. Mousing over the table triggers a change that forces the table into "React" mode when the table cells become more complex.


## Building

### Initial setup
Once you've checked this project, you'll need to download the css dependencies using [bower](https://bower.io/). Assuming you have bower installed already, it's just
Expand All @@ -107,6 +107,18 @@ Once you've checked this project, you'll need to download the css dependencies u
bower install
```

### Quickstart

These commands are explained in more depth below, but if you know what you want here's a quick reference of the most useful ones.

```
lein dev # start dev server with hot-reloading
lein repl # start dev server with hot-reloading and nrepl (no clean or css)
lein deploy # build prod release and deploy to clojars
lein format # run cljfmt to fix code indentation
```

### Compile css:

Compile css file once.
Expand Down Expand Up @@ -143,6 +155,8 @@ The above command assumes that you have [phantomjs](https://www.npmjs.com/packag

## Production Build

### Deploying to Heroku

```
lein clean
lein uberjar
Expand Down Expand Up @@ -171,3 +185,12 @@ To compile clojurescript to javascript:
lein clean
lein cljsbuild once min
```

### Releasing a new version

The release process is a combination of the above commands, with some additional steps. Generally, you'll want to do the following.

1. Update the version number in **project.clj**.
1. Commit this change and tag it using `git tag -a v1.0.0 -m "Release v1.0.0"`, replacing *1.0.0* with your version number.
1. Push your commit and tag using `git push origin` followed by `git push origin v1.0.0` (again replace *1.0.0* with your version number). Make sure that you push to the intermine repository, not just your fork!
1. Deploy a new uberjar to Clojars with `lein deploy`.
7 changes: 7 additions & 0 deletions dev/user.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
;; This namespace starts figwheel as part of the aliases:
;; lein dev
;; lein repl
(ns user
(:require [figwheel-sidecar.repl-api :refer [start-figwheel!]]))

(start-figwheel!)
107 changes: 61 additions & 46 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@
[joshkh/ctrlz "0.3.0"]
[binaryage/oops "0.7.0"]
[inflections "0.13.2"]
[re-frisk "0.5.4.1"]
[criterium "0.4.5"]
[org.intermine/imcljs "0.7.0"]]
[org.intermine/imcljs "1.0.1"]]

:plugins [[lein-cljsbuild "1.1.7"]
[lein-less "1.7.5"]
[lein-ancient "0.6.15"]]
[lein-ancient "0.6.15"]
[lein-pdo "0.1.1"]
[lein-cljfmt "0.6.1"]]

:aliases {"dev" ["do" "clean"
["pdo"
["trampoline" "less" "auto"]
["with-profile" "+repl" "run"]]]
"build" ["do" "clean"
["less" "once"]
["cljsbuild" "once" "min"]]
"deploy" ["with-profile" "+uberjar" "deploy" "clojars"]
"format" ["cljfmt" "fix"]}

:repositories {"clojars" {:sign-releases false}}

:min-lein-version "2.5.3"
:min-lein-version "2.8.1"

:source-paths ["src"]

Expand All @@ -35,48 +46,52 @@
:figwheel {:css-dirs ["resources/public/css"]
:server-port 3448}

:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]
:timeout 120000}

:less {:source-paths ["less"]
:target-path "resources/public/css"}

:profiles
{:dev
{:dependencies [[binaryage/devtools "0.9.10"]]

:plugins [[lein-figwheel "0.5.15"]
[lein-doo "0.1.7"]]}}


:cljsbuild
{:builds
[{:id "dev"
:source-paths ["src"]
:figwheel {:on-jsload "im-tables.core/mount-root"}
:compiler {:main im-tables.core
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled/out"
:asset-path "js/compiled/out"
:source-map-timestamp true
:preloads [devtools.preload]
:parallel-build true
:external-config {:devtools/config {:features-to-install :all}}}}


{:id "min"
:source-paths ["src"]
:jar true
:compiler {:main im-tables.core
:output-to "resources/public/js/compiled/app.js"
:optimizations :advanced
:closure-defines {goog.DEBUG false}
:pretty-print false}}

{:id "test"
:source-paths ["src" "test/cljs"]
:compiler {:main im-tables.runner
:output-to "resources/public/js/compiled/test.js"
:output-dir "resources/public/js/compiled/test/out"
:optimizations :none}}]})


;:prep-tasks [["cljsbuild" "once" "min"] ["less" "once"] "compile"]

:main im-tables.core

:profiles {:dev {:dependencies [[binaryage/devtools "0.9.10"]
[day8.re-frame/re-frame-10x "0.4.3"]
[day8.re-frame/tracing "0.5.1"]
[figwheel-sidecar "0.5.19"]
[cider/piggieback "0.4.1"]]
:plugins [[lein-figwheel "0.5.19"]
[lein-doo "0.1.8"]]}
:repl {:source-paths ["dev"]}
:uberjar {:prep-tasks ["build"]}}

:cljsbuild {:builds [{:id "dev"
:source-paths ["src"]
:figwheel {:on-jsload "im-tables.core/mount-root"}
:compiler {:main im-tables.core
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled/out"
:asset-path "js/compiled/out"
:source-map-timestamp true
:parallel-build true
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true
"day8.re_frame.tracing.trace_enabled_QMARK_" true}
:preloads [devtools.preload
day8.re-frame-10x.preload]
:external-config {:devtools/config {:features-to-install :all}}}}


{:id "min"
:source-paths ["src"]
:jar true
:compiler {:main im-tables.core
:output-to "resources/public/js/compiled/app.js"
:optimizations :advanced
:closure-defines {goog.DEBUG false}
:pretty-print false}}

{:id "test"
:source-paths ["src" "test/cljs"]
:compiler {:main im-tables.runner
:output-to "resources/public/js/compiled/test.js"
:output-dir "resources/public/js/compiled/test/out"
:optimizations :none}}]})
7 changes: 7 additions & 0 deletions src/im_tables/core.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(ns im-tables.core)

(defn -main
"Dummy main method that doesn't do anything. This namespace exists only
so we can use `lein run` even though this project is CLJS only."
[& _args]
nil)
3 changes: 0 additions & 3 deletions src/im_tables/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[im-tables.views :as views]
[im-tables.config :as config]
[imcljs.query :as query]
[re-frisk.core :refer [enable-re-frisk!]]
[cljsjs.react-transition-group]
[cljsjs.highlight]
[cljsjs.highlight.langs.javascript]
Expand All @@ -16,11 +15,9 @@
[cljsjs.highlight.langs.ruby]
[cljsjs.highlight.langs.java]))


(defn dev-setup []
(when config/debug?
(enable-console-print!)
(enable-re-frisk!)
(println "dev mode")))

(defn mount-root []
Expand Down

0 comments on commit f40b285

Please sign in to comment.