Skip to content

Commit

Permalink
Webly2 (#1)
Browse files Browse the repository at this point in the history
* new webly, it compiles

* compiling js ok

* nbeval working

* viewer working

* ns refactored

* viewer working

* misc

* repl working

* viewer nb from url

* viewer welcome notebook

* ci fixed

---------

Co-authored-by: awb99 <[email protected]>
  • Loading branch information
awb99 and awb99 authored Apr 12, 2024
1 parent 12f14ff commit b4cd77a
Show file tree
Hide file tree
Showing 72 changed files with 774 additions and 991 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
run: |
cd reval
clojure -M:cljfmt
cd ../reval-ui
clojure -M:cljfmt
shell: bash
- name: test-clj
run: |
Expand All @@ -44,24 +46,8 @@ jobs:
CLOJARS_PASSWORD: ${{ secrets.ReleasePassword }}
CODECOV_TOKEN: ${{ secrets.CodecovToken }}
run: |
cd reval-goldly
cd reval-ui
git config --global user.email "[email protected]"
git config --global user.name "CI/CD"
clojure -T:build-jar jar
clojure -T:build-jar deploy
# clojure -M:release --patch
# git push --tags
#
# rm src/goldly_bindings_generated.cljs
# clojure -M:release tag --minor
# clojure -M:release pom
# clojure -M:release jar
# clojure -M:release deploy
# lein release
# bash <(curl -s https://codecov.io/bash)
# lein with-profile +relay-jetty cloverage
# bash <(curl -s https://codecov.io/bash) -f target/coverage/codecov.json
#
# Could not transfer metadata foo:bar/maven-metadata.xml from/to releases (https://clojars.org/repo): Read timed out
# Default 10000 not enough for us
# export LEIN_JVM_OPTS="-Dmaven.wagon.rto=90000"
clojure -T:build jar
clojure -T:build deploy
32 changes: 0 additions & 32 deletions .github/workflows/pr.yml

This file was deleted.

14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@

## DEMO - Get Started
- clone this repo
- Run in directory *demo*:
```
clj -X:goldly:build :profile '"npm-install"'
clj -X:goldly:build :profile '"compile2"'
clj -X:goldly
cd demo
clj -X:nbeval
clj -X:webly:npm-install
clj -X:webly:compile
clj -X:webly:run
```
Open Browser on Port 8080


## scratchpad
- you can send vizualisations of your clj expressions to the scratchpad
- `->scratchpad` sends the vizualisation to the browser.
- Open the repo in your preferred ide. Connect to nrepl on port 9100.
- demo/demo/scratchpad.clj or Eval demo/demo/notebook.clj

## configuration

Expand Down
59 changes: 31 additions & 28 deletions demo/deps.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{:paths ["src" "resources"]
:deps
{org.pinkgorilla/reval-goldly {:local/root "../reval-goldly" :deps/manifest :deps}}
{org.pinkgorilla/reval {:local/root "../reval" :deps/manifest :deps}
org.pinkgorilla/reval-ui {:local/root "../reval-ui" :deps/manifest :deps}
org.pinkgorilla/webly {:mvn/version "0.5.660"}
;org.pinkgorilla/ui-repl {:mvn/version "0.1.92"}
; ui modules for demo notebooks:
org.pinkgorilla/ui-highcharts {:mvn/version "0.0.28"}
}

:aliases
{; https://github.com/weavejester/cljfmt
Expand All @@ -11,33 +17,30 @@
{:extra-deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}
:main-opts ["-m" "cljfmt.main" "fix" "--indents" "cljfmt.edn"]}

;; nrepl only
:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "1.0.0"}
cider/cider-nrepl {:mvn/version "0.28.5"}
}
:main-opts ["-m" "nrepl.cmdline"
"--middleware" "[cider.nrepl/cider-middleware]"
"--port" "9100"
]}

;; nb eval
:nbeval {:extra-paths ["demo"]
:exec-fn reval.task/nbeval}

; demo ui
:webly {:exec-fn webly.app.app/webly-build
:exec-args {:config ["reval/demo-config.edn"]
:profile "npm-install"}}

:npm-install {:exec-args {:profile "npm-install"}}
:compile {:exec-args {:profile "compile2"}}
:release {:exec-args {:profile "release"}}
:release-adv {:exec-args {:profile "release-adv"}}
:static {:exec-args {:profile "static"}}
:ci {:exec-args {:profile "ci"}}

:goldly
{:extra-paths ["target/webly" ; to include the sci-bindings info
"node_modules"]
:extra-deps {org.pinkgorilla/goldly {:mvn/version "0.4.604"}
nrepl/nrepl {:mvn/version "1.0.0"}
cider/cider-nrepl {:mvn/version "0.28.5" #_"0.32.0"}
}
:exec-fn modular.system/start!
:exec-args {:profile "jetty"
:services "reval/demo-services.edn"
:config ["webly/config.edn" "goldly/config.edn" "reval/demo-config.edn"]}}
:run {:exec-fn modular.system/start!
:exec-args {:profile "jetty"
:config ["reval/demo-config.edn"]
:services "reval/demo-services.edn"}}

:build
{:exec-fn goldly.app.build/goldly-build
:exec-args {:profile "compile2"}}}}
:nbeval {:exec-fn modular.system/start!
:exec-args {:run reval.task/eval-all-collections
:config ["reval/demo-config.edn"]
:services "reval/task-services.edn"}}
:nblist {:exec-fn modular.system/start!
:exec-args {:run reval.task/print-all-collections
:config ["reval/demo-config.edn"]
:services "reval/task-services.edn"}}

}}
11 changes: 11 additions & 0 deletions demo/resources/ext/demo.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{:name "demo-reval"
:lazy true
:depends-on #{:reval-ui}

:cljs-routes {"" reval.page.viewer/viewer-page
; "devtools/repl" :repl

}

;
}
20 changes: 11 additions & 9 deletions demo/resources/reval/demo-config.edn
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{:goldly {:lazy true
; run
:routes {:app {"" :repl
"devtools/repl" :repl
"devtools/viewer" :viewer
"devtools/scratchpad" :scratchpad}
:api {}}}

:reval {:rdocument {:storage-root "rdocument/"
{:build {:disabled-extensions #{; extensions using sci-configs will not work in webly.
"reagent" "re-frame"
"funcool-promesa"
"applied-science.js-interop"
; webly2 is now in webly. needs to be removed from ui-repl.
"webly2"
"ui-repl"
"cljs-ajax"
}}

:reval {:rdocument {:storage-root "target/webly/public/rdocument/"
:url-root "/api/rdocument/file/"}
:collections {:test27 [:clj "notebook/test27/"]
:test27-cljs [:cljs "notebook/test27/"]
Expand Down
42 changes: 7 additions & 35 deletions demo/resources/reval/demo-services.edn
Original file line number Diff line number Diff line change
@@ -1,47 +1,19 @@
{:modular (modular.system/modular-env) ; {:profile "jetty" :config ["demo.edn" "secrets.edn"]}
;:secrets #include "secrets.edn" ;; externalised and usually "mounted" as a docker/kubernetes secret
:components
{; the print services can be comment out. Just useful for testing.
:print-modular-env {:start (println "modular environment: " #ref [:modular])}
:config {:start (modular.config/load-config! (:config #ref [:modular]))}

:timbre {:start (modular.log/timbre-config!
(:timbre/clj (deref (clip/ref :config))))}

; goldly service returns {:ns-clj :webly ; this are used to start clj-require and webly
; :ws-watch :cljs-watch} ; this is used when stopping goldly
:goldly {:start (goldly.app.run/start-goldly
(deref (clip/ref :config))
(:profile #ref [:modular]))
:stop (goldly.app.run/stop-goldly this)}

;:print-goldly-env {:start (println "goldly environment: " (clip/ref :goldly))}
;:print-goldly-webly-config {:start (println "webly (dynamic config): " (:webly (clip/ref :goldly)))}
;:print-goldly-ns-clj-config {:start (println "ns-clj (dynamic config): " (:ns-clj (clip/ref :goldly)))}

; load the :ns-clj defined by the user [demo.service]
:ns-require {:start (modular.require/require-namespaces
(:ns-clj (deref (clip/ref :config))))}

; goldly extension clj-ns-loader is requiring already
;:ns-require {:start (modular.require/require-namespaces
;(:ns-clj (clip/ref :goldly)))}
{:config {:start (modular.config/load-config! (:config #ref [:modular]))}
:exts {:start (extension/discover)}

:webly {:start (webly.app.app/start-webly
(:webly (clip/ref :goldly)) ; use webly config generated by goldly.
(deref (clip/ref :config))
(:profile #ref [:modular]))
:stop (webly.app.app/stop-webly this)}

:nrepl {:start (nrepl.server/start-server
:bind "0.0.0.0"
:port 9100
:middleware cider.nrepl.middleware/cider-middleware
:handler cider.nrepl/cider-nrepl-handler
)
:stop (.close this)}


:clj-service {:start (goldly.service/start-clj-services
(clip/ref :exts))}

:reval {:start (reval.config/set-config!
(:reval (deref (clip/ref :config))))}


;
Expand Down
11 changes: 11 additions & 0 deletions demo/resources/reval/task-services.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{:modular (modular.system/modular-env) ; {:profile "jetty" :config ["demo.edn" "secrets.edn"]}
;:secrets #include "secrets.edn" ;; externalised and usually "mounted" as a docker/kubernetes secret
:components
{:config {:start (modular.config/load-config! (:config #ref [:modular]))}
:exts {:start (extension/discover)}

:reval {:start (reval.config/set-config!
(:reval (deref (clip/ref :config))))}

;
}}
28 changes: 0 additions & 28 deletions demo/src/demo/nrepl/collection.clj

This file was deleted.

58 changes: 0 additions & 58 deletions demo/src/demo/nrepl/scratchpad.clj

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion demo/src/notebook/test27/fira_code.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns notebook.test.fira-code)
(ns notebook.test27.fira-code)

; if the threading macro appears different, then the correct font got loaded.
25
Expand Down
2 changes: 1 addition & 1 deletion demo/src/notebook/test27/reval_image.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns notebook.test.reval-image
(ns notebook.test27.reval-image
(:require
[clojure.java.io :as io]
[modular.persist.protocol :refer [loadr]]
Expand Down
6 changes: 3 additions & 3 deletions demo/src/notebook/test27/text.clj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
(ns notebook.test.text
(ns notebook.test27.text
(:require
[reval.goldly.display :as display]))
[reval.display :as display]))

; seqs and maps are not implemented
; the question is what is an efficient show way that is also nice.
(+ 1 1)
[1 2 3]

^:R
['reval.goldly.ui-helper/text2 "hello\nworld"]
['reval.ui-helper/text2 "hello\nworld"]

^:R
['notebook.test27.greeter/greet {:name "Wolfgang"}]
Expand Down
Loading

0 comments on commit b4cd77a

Please sign in to comment.