Stopped loading Figwheel API by default #2669

Signed-off-by: andytudhope <tuddy0525@gmail.com>
This commit is contained in:
Audrius Molis 2017-12-17 19:16:42 +02:00 committed by andytudhope
parent 2f4c750d8a
commit 3e940b5bd4
No known key found for this signature in database
GPG Key ID: 02A3DFA93BF26AD2
4 changed files with 33 additions and 36 deletions

View File

@ -79,13 +79,13 @@ prod-build:
# -------------
repl: ##@repl Start REPL for iOS and Android
BUILD_IDS="ios,android" lein repl
lein figwheel-repl ios android
repl-ios: ##@repl Start REPL for iOS
BUILD_IDS="ios" lein repl
lein figwheel-repl ios
repl-android: ##@repl Start REPL for Android
BUILD_IDS="android" lein repl
lein figwheel-repl android
#--------------
# Run

View File

@ -1,17 +1,8 @@
(ns user
(ns figwheel-api
(:use [figwheel-sidecar.repl-api :as ra])
(:require [hawk.core :as hawk]
[re-frisk-sidecar.core :as rfs]
[clojure.string :as s]))
;; This namespace is loaded automatically by nREPL
;; read project.clj to get build configs
(def profiles (->> "project.clj"
slurp
read-string
(drop-while #(not= % :profiles))
(apply hash-map)
:profiles))
(defn get-test-build [build]
(update build :source-paths
@ -21,9 +12,6 @@
(conj "env/test" "test/cljs")
vec)))))
(def cljs-builds
(get-in profiles [:dev :cljsbuild :builds]))
(defn start-figwheel
"Start figwheel for one or more builds"
[build-ids cljs-builds]
@ -32,21 +20,11 @@
:build-ids build-ids
:all-builds cljs-builds}))
(def start-cljs-repl ra/cljs-repl)
(defn stop-figwheel
"Stops figwheel"
[]
(ra/stop-figwheel!))
(hawk/watch! [{:paths ["resources"]
:handler (fn [ctx e]
(let [path "src/status_im/utils/js_resources.cljs"
js-resourced (slurp path)]
(spit path (str js-resourced " ;;"))
(spit path js-resourced))
ctx)}])
(defn test-id? [id]
(s/includes? (name id) "-test"))
@ -67,10 +45,28 @@
:id id))
ids))
(let [env-build-ids (System/getenv "BUILD_IDS")
build-ids (if env-build-ids
(map keyword (s/split env-build-ids #","))
[:android])
builds (get-builds build-ids cljs-builds)]
(start-figwheel build-ids builds)
(rfs/-main))
(defn start-cljs-repl []
(hawk/watch! [{:paths ["resources"]
:handler (fn [ctx e]
(let [path "src/status_im/utils/js_resources.cljs"
js-resourced (slurp path)]
(spit path (str js-resourced " ;;"))
(spit path js-resourced))
ctx)}])
(let [build-ids (if *command-line-args*
(map keyword *command-line-args*)
[:android])
;; read project.clj to get build configs
profiles (->> "project.clj"
slurp
read-string
(drop-while #(not= % :profiles))
(apply hash-map)
:profiles)
cljs-builds (get-in profiles [:dev :cljsbuild :builds])
builds (get-builds build-ids cljs-builds)]
(start-figwheel build-ids builds)
(rfs/-main))
(ra/cljs-repl))
(start-cljs-repl)

View File

@ -19,6 +19,7 @@
["do" "clean"
["with-profile" "prod" "cljsbuild" "once" "ios"]
["with-profile" "prod" "cljsbuild" "once" "android"]]
"figwheel-repl" ["run" "-m" "clojure.main" "env/dev/figwheel_api.clj"]
"test-cljs" ["with-profile" "test" "doo" "node" "test" "once"]
"test-protocol" ["with-profile" "test" "doo" "node" "protocol" "once"]}
:figwheel {:nrepl-port 7888}
@ -30,14 +31,14 @@
:source-paths ["src" "env/dev"]
:cljsbuild {:builds
{:ios
{:source-paths ["react-native/src" "src" "env/dev"]
{:source-paths ["react-native/src"]
:figwheel true
:compiler {:output-to "target/ios/app.js"
:main "env.ios.main"
:output-dir "target/ios"
:optimizations :none}}
:android
{:source-paths ["react-native/src" "src" "env/dev"]
{:source-paths ["react-native/src"]
:figwheel true
:compiler {:output-to "target/android/app.js"
:main "env.android.main"

View File

@ -64,7 +64,7 @@ fi
lein deps && ./re-natal deps && ./re-natal use-android-device "${device_type}" && ./re-natal use-figwheel
# open figwheel in new tab
tab "BUILD_IDS=${cljs_build} lein repl"
tab "lein figwheel-repl ${cljs_build}"
# open react-native package in new tab
tab "react-native start"