Add npm install
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8962b9d930
commit
443fd967ab
10
.drone.yml
10
.drone.yml
|
@ -1,12 +1,20 @@
|
|||
kind: pipeline
|
||||
name: default
|
||||
steps:
|
||||
- name: npm-deps
|
||||
image: node
|
||||
commands:
|
||||
- cd reagent-reitit-demo
|
||||
- npm install
|
||||
#- npx shadow-cljs build app
|
||||
|
||||
- name: Build
|
||||
image: clojure:tools-deps
|
||||
commands:
|
||||
- cd reagent-reitit-demo
|
||||
- cp resources/public/rename-me-index.html resources/public/index.html
|
||||
- clj -A:prod
|
||||
- clj -Mbuild-dev release app
|
||||
#- clj -A:prod
|
||||
|
||||
- name: deploy-site
|
||||
pull: True
|
||||
|
|
|
@ -30,4 +30,6 @@
|
|||
com.bhauman/figwheel-main {:mvn/version "0.2.18"}}
|
||||
:paths ["src" "resources"]
|
||||
:aliases {:prod {:main-opts ["-m" "figwheel.main" "-bo" "dev"]}
|
||||
:build-dev {:extra-deps {thheller/shadow-cljs {:mvn/version "2.23.3"}}
|
||||
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
|
||||
:dev {:extra-deps {thheller/shadow-cljs {:mvn/version "2.23.3"}}}}}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div id="app">
|
||||
loading here
|
||||
</div>
|
||||
<script src="/cljs-out/dev-main.js" type="text/javascript"></script>
|
||||
<script src="/cljs-out/main_bundle.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
:deps {:aliases [:dev]}
|
||||
:dev-http {8080 "resources/public/"}
|
||||
:source ["src" "../../components"]
|
||||
:builds {:app {:output-dir "resources/public/cljs-out/"
|
||||
:asset-path "."
|
||||
:target :browser
|
||||
:compiler-options {:infer-externs :auto
|
||||
:output-feature-set :es6}
|
||||
:modules {:main_bundle {:init-fn clojure-demo.core/startup!}}
|
||||
:devtools {:after-load app.main/reload!}}}}
|
|
@ -1,6 +1,6 @@
|
|||
(ns ^:figwheel-hooks clojure-demo.core
|
||||
(:require ["react-dom/client" :refer [createRoot]]
|
||||
["@codemirror/state" :as cm-state :refer [EditorState] ]
|
||||
["@codemirror/state" :as cm-state :refer [EditorState Transaction] ]
|
||||
["@codemirror/view" :as cm-view :refer [EditorView ViewUpdate]]
|
||||
["@codemirror/commands" :as cm-commands :refer [defaultKeymap]]
|
||||
["@codemirror/theme-one-dark" :refer [oneDark]]
|
||||
|
@ -59,22 +59,36 @@
|
|||
;(def sci-ctx (sci/empty-environment))
|
||||
(sci/alter-var-root sci/print-fn (constantly *print-fn*))
|
||||
|
||||
(defn fetch-selected-text [v transactions]
|
||||
(reduce (fn [text t]
|
||||
(if (= "select.pointer" (str (.annotation t (.-userEvent Transaction) )))
|
||||
(conj text
|
||||
(.sliceDoc
|
||||
^EditorState (.-state v)
|
||||
(.-from (.-main (.-selection t)))
|
||||
(.-to (.-main (.-selection t)))))
|
||||
text))
|
||||
[]
|
||||
transactions))
|
||||
|
||||
(defn code-editor
|
||||
[content]
|
||||
(let [editor (atom nil)
|
||||
evaled-result (reagent/atom nil)
|
||||
update-timeout (reagent/atom nil)
|
||||
update-fn (.of (.-updateListener EditorView)
|
||||
(fn [^ViewUpdate v]
|
||||
(fn [^ViewUpdate view-update]
|
||||
(js/clearTimeout @update-timeout)
|
||||
(reset! update-timeout
|
||||
(js/setTimeout
|
||||
(fn []
|
||||
(let [selected-text (fetch-selected-text view-update (.-transactions view-update))
|
||||
eval-code (if (seq selected-text)
|
||||
(first selected-text)
|
||||
(.-doc (.-state view-update)))]
|
||||
(reset! evaled-result (sci/eval-string* sci-ctx
|
||||
(.toString (.-doc (.-state v))) #_content ))
|
||||
(prn "updated delayed")) 2000))
|
||||
#_(when (.-docChanged v)
|
||||
(prn v))))
|
||||
(.toString eval-code) ))
|
||||
(prn "updated delayed"))) 1000))))
|
||||
start-state
|
||||
(.create EditorState
|
||||
(clj->js {:doc content
|
||||
|
|
Loading…
Reference in New Issue