Skip to content

Commit c375a54

Browse files
authored
Merge pull request #10 from metasoarous/master
Latest changes
2 parents 72886cb + 73c0a19 commit c375a54

File tree

19 files changed

+6596
-6741
lines changed

19 files changed

+6596
-6741
lines changed

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: metasoarous
4+
5+
#patreon: # Replace with a single Patreon username
6+
#open_collective: # Replace with a single Open Collective username
7+
#ko_fi: # Replace with a single Ko-fi username
8+
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
9+
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
10+
#liberapay: # Replace with a single Liberapay username
11+
#issuehunt: # Replace with a single IssueHunt username
12+
#otechie: # Replace with a single Otechie username
13+
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ check-clean-tree:
4444
.PHONY: build
4545
build:
4646
rm -rf resources/oz/public/js && \
47+
rm -rf .shadow-cljs && \
4748
npm install && \
48-
shadow-cljs release app lib && \
49+
clojure -M:shadow-cljs release app lib && \
4950
clojure -A:pack mach.pack.alpha.skinny --no-libs --project-path target/oz.jar
5051

5152
.PHONY: release
@@ -55,6 +56,7 @@ release: check-clean-tree build
5556
git commit -m "add build targets" && \
5657
git push origin && \
5758
clojure -Spom && \
59+
./bin/munge-provided-deps.clj && \
5860
mvn -e deploy:deploy-file -Dfile=target/oz.jar -DrepositoryId=clojars -Durl=https://clojars.org/repo -DpomFile=pom.xml
5961

6062
.PHONY: clean

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Here's another which focuses on the philosophical ideas behind Vega & Vega-Lite,
4545
[![Seajure Clojure + Vega/Vega-Lite talk](https://i.imgur.com/SmIPUQtm.png)](https://www.youtube.com/watch?v=hXq5Bb40zZY)
4646

4747
This Readme is the canonical entry point for learning about Oz.
48-
You may also want to check out the [clojdoc page](https://cljdoc.org/d/metasoarous/oz) (if you're not there already) for API & other docs, and look at the [examples directory](https://github.com/metasoarous/oz/tree/master/examples) of this project (references occassionally below).
48+
You may also want to check out the [clojdoc page](https://cljdoc.org/d/metasoarous/oz) (if you're not there already) for API & other docs, and look at the [examples directory](https://github.com/metasoarous/oz/tree/master/resources/oz/examples) of this project (references occassionally below).
4949

5050

5151
### Ecosystem
@@ -483,12 +483,24 @@ The great thing about static sites is that they are easy and cheap to deploy and
483483

484484
## Local CLJS development
485485

486-
Oz is now compiled (on the cljs side) with [Shadow-CLJS](http://shadow-cljs.org/).
487-
A typical workflow involves running `shadow-cljs watch app devcards`.
488-
This will compile both the `app.js` and `devcards.js` compile targets (to `resources/oz/public/js/`), meaning you can run the REPL/JVM tooling locally, and it will serve up the latest edition of the `app.js` for calling `view!`, etc.
489-
But also, visiting <https://localhost:7125/devcards.html> will pull up a live view of a set of example components defined at `src/cljs/oz/core_devcards.cljs`.
486+
Oz is now compiled (on the cljs side) with [Shadow-CLJS](http://shadow-cljs.org/), together with the Clojure CLI tooling.
487+
A typical workflow involves running `clj -M:shadow-cljs watch devcards app` (note, older versions of `clj` use `-A` instead of `-M`; consider updating).
488+
This will watch your cljs files for changes, and immediately compile both the `app.js` and `devcards.js` targets (to `resources/oz/public/js/`).
489+
490+
In general, the best way to develop is to visit <https://localhost:7125/devcards.html>, which will pull up a live view of a set of example Reagent components defined at `src/cljs/oz/core_devcards.cljs`.
490491
This is the easiest way to tweak functionality and test new features, as editing `src/cljs/oz/core.cljs` will trigger updates to the devcards views.
491492

493+
If it's necessary or desirable to test the app (live-view, etc) functionality "in-situ", you can also use the normal Clj REPL utilities to feed plots to the `app.js` target using `oz/view!`, etc.
494+
Note that if you do this, you will need to use whatever port is passed to `oz/view!` (by default, 10666) and not the one printed out when you start `clj -M:shadow-cljs`.
495+
496+
See documentation for your specific editing environment if you'd like your editor to be able to connect to the Shadow-CLJS repl.
497+
For `vim-fireplace`, the initial Clj connection should establish itself automatically when you attempt to evaluate your first form.
498+
From there simply execute the vim command `:CljEval (shadow/repl :app)`, and you should be able to evaluate code in the `*.cljs` files from vim.
499+
Code in `*.clj` files should also continue to evaluate as before as well.
500+
501+
IMPORTANT NOTE: If you end up deploying a version of Oz to Clojars or elsewhere, make sure you stop your `clj -M:shadow-cljs watch` process before running `make release`.
502+
If you don't, shadow will continue watching files and rebuild js compilation targets with dev time configuration (shadow, less minification, etc), that shouldn't be in the final release build.
503+
If however you are simply making changes and pushing up for me to release, please just leave any compiled changes to the js targets out of your commits.
492504

493505

494506
## Debugging & updating Vega/Vega-Lite versions

bin/munge-provided-deps.clj

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env bb
2+
3+
(require '[clojure.data.xml :as xml]
4+
'[clojure.string :as string]
5+
'[clojure.walk :as walk]
6+
'[clojure.pprint :as pp])
7+
8+
(def pom-xml
9+
(xml/parse (io/reader "pom.xml")))
10+
11+
(def pom-ns (namespace (:tag (second (:content pom-xml)))))
12+
13+
(defn nsify
14+
[key]
15+
(keyword pom-ns (name key)))
16+
17+
(def clojupyter-version
18+
(-> (slurp "deps.edn")
19+
(read-string)
20+
:aliases
21+
:clojupyter
22+
:extra-deps
23+
(get 'clojupyter/clojupyter)
24+
:mvn/version))
25+
26+
(println "clojupyter version is:" clojupyter-version)
27+
28+
(def clojupyter-dep
29+
(xml/sexp-as-element
30+
[(nsify :dependency)
31+
[(nsify :groupId) "clojupyter"]
32+
[(nsify :artifactId) "clojupyter"]
33+
[(nsify ::version) clojupyter-version]
34+
[(nsify ::scope) "provided"]]))
35+
36+
(def strip-emtpy-lines
37+
(partial remove
38+
(comp empty? string/trim)))
39+
40+
41+
(defn stringify-xml [xml]
42+
(->> xml
43+
(xml/indent-str)
44+
(string/split-lines)
45+
(strip-emtpy-lines)
46+
(interpose "\n")
47+
(apply str)))
48+
49+
(defn decorate-xml
50+
[xml attrs]
51+
(walk/postwalk
52+
(fn [{:as elmt :keys [tag]}]
53+
(if tag
54+
(update elmt :attrs merge attrs)
55+
elmt))
56+
xml))
57+
58+
(defn add-clojupyter-dep
59+
[{:as xml :keys [content attrs]}]
60+
(let [clojupyter-dep clojupyter-dep]
61+
;(let [clojupyter-dep (decorate-xml clojupyter-dep attrs)]
62+
(assoc xml
63+
:content
64+
(map
65+
(fn [{:as elmt :keys [tag content]}]
66+
(if (and tag (= "dependencies" (name tag)))
67+
(update elmt :content concat [clojupyter-dep])
68+
elmt))
69+
content))))
70+
71+
(->> pom-xml
72+
(add-clojupyter-dep)
73+
(xml/emit-str)
74+
;(println))
75+
(spit "pom.xml"))
76+
77+
78+

deps.edn

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,54 @@
11
{:paths ["src/clj" "src/cljs" "resources"]
2-
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
3-
org.clojure/clojurescript {:mvn/version "1.10.439"} ;; equivalent of :scope "provided"?
2+
:deps {org.clojure/clojure {:mvn/version "1.10.1"}
3+
org.clojure/clojurescript {:mvn/version "1.10.764"} ;; equivalent of :scope "provided"?
44
;; this appears to be necessary for fiwheel to work for some applications
55
org.clojure/tools.reader {:mvn/version "1.3.2"}
66
org.clojure/core.async {:mvn/version "0.4.490"}
7-
cheshire {:mvn/version "5.8.1"}
8-
clj-http {:mvn/version "3.9.1"}
7+
cheshire/cheshire {:mvn/version "5.8.1"}
8+
clj-http/clj-http {:mvn/version "3.9.1"}
99
com.taoensso/sente {:mvn/version "1.13.1"}
1010
com.taoensso/timbre {:mvn/version "4.10.0"}
11+
com.taoensso/encore {:mvn/version "2.120.0"}
12+
devcards/devcards {:mvn/version "0.2.6"}
13+
reagent/reagent {:mvn/version "0.10.0"}
14+
;; consider using this for lazy loading clojupyter stuff
1115
;com.clojure-goes-fast/lazy-require {:mvn/version "0.1.1"}
12-
aleph {:mvn/version "0.4.6"}
13-
ring {:mvn/version "1.7.1"}
16+
aleph/aleph {:mvn/version "0.4.6"}
17+
ring/ring {:mvn/version "1.8.1"}
1418
ring/ring-defaults {:mvn/version "0.3.2"}
1519
bk/ring-gzip {:mvn/version "0.3.0"}
16-
ring-cljsjs {:mvn/version "0.1.0"}
17-
compojure {:mvn/version "1.6.1"}
18-
;hiccup {:mvn/version "1.0.5"}
19-
hiccup {:mvn/version "2.0.0-alpha2"}
20+
compojure/compojure {:mvn/version "1.6.1"}
21+
hiccup/hiccup {:mvn/version "2.0.0-alpha2"}
2022
com.cognitect/transit-clj {:mvn/version "0.8.313"}
2123
com.cognitect/transit-cljs {:mvn/version "0.8.256"}
22-
reagent {:mvn/version "0.10.0"}
23-
;cljsjs/vega {:mvn/version "5.9.0-0"}
24-
;cljsjs/vega-lite {:mvn/version "4.0.2-0"}
25-
;cljsjs/vega-embed {:mvn/version "6.0.0-0"}
26-
;cljsjs/vega-tooltip {:mvn/version "0.20.0-0"}
27-
markdown-clj {:mvn/version "1.10.0"}
28-
hickory {:mvn/version "0.7.1"}
29-
markdown-to-hiccup {:mvn/version "0.6.2"}
30-
;; leave this out; causes dependency issues
31-
;org.clojars.didiercrunch/clojupyter {:mvn/version "0.1.5"}
32-
;; must be above yaml for jvm compilation fix
24+
markdown-clj/markdown-clj {:mvn/version "1.10.0"}
25+
hickory/hickory {:mvn/version "0.7.1"}
26+
markdown-to-hiccup/markdown-to-hiccup {:mvn/version "0.6.2"}
3327
org.flatland/ordered {:mvn/version "1.5.7"}
3428
io.forward/yaml {:mvn/version "1.0.9"}
35-
commonmark-hiccup {:mvn/version "0.1.0"}
29+
commonmark-hiccup/commonmark-hiccup {:mvn/version "0.1.0"}
3630
org.clojure/spec.alpha {:mvn/version "0.2.176"}
3731
irresponsible/tentacles {:mvn/version "0.6.3"}
38-
respeced {:mvn/version "0.0.1"}
32+
respeced/respeced {:mvn/version "0.0.1"}
3933
org.clojure/test.check {:mvn/version "0.10.0"}
40-
hawk {:mvn/version "0.2.11"}
34+
hawk/hawk {:mvn/version "0.2.11"}
4135
metasoarous/darkstar {:mvn/version "0.1.0"}}
4236
;applied-science/darkstar {:git/url "https://github.com/applied-science/darkstar/"
4337
;:sha "ef93147377d09a3894959c2c43faabf1a527a7d5"}}
4438
;timofreiberg/bultitude {:mvn/version "0.3.0"}
4539
;org.clojure/tools.namespace {:mvn/version "0.2.11"}
4640
:aliases {:dev {:extra-paths ["dev"]
47-
:extra-deps {alembic {:mvn/version "0.3.2"}}}
41+
:extra-deps {alembic/alembic {:mvn/version "0.3.2"}}}
4842
;binaryage/devtools {:mvn/version "0.9.10"}}}
49-
:clojupyter {:extra-deps {clojupyter {:mvn/version "0.3.2"}}}
43+
:clojupyter {:extra-deps {clojupyter/clojupyter {:mvn/version "0.3.2"
44+
:exclusions [hiccup/hiccup]}}}
45+
:shadow-cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.11.5"}
46+
cider/cider-nrepl {:mvn/version "0.21.1"}}
47+
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
48+
:codox {:extra-deps {codox/codox {:mvn/version "0.10.7"}}
49+
:exec-fn codox.main/generate-docs
50+
:exec-args {:language :clojure
51+
:output-path "docs"}}
5052
:pack {:extra-deps {pack/pack.alpha {:git/url "https://github.com/juxt/pack.alpha.git"
5153
:sha "c70740ffc10805f34836da2160fa1899601fac02"}}
5254
:main-opts ["-m"]}}}

dev/user.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262

6363
;; vega example
64-
(def contour-plot (json/parse-string (slurp "resources/oz/examples/contour-lines.vega.json")))
64+
(def contour-plot (json/parse-string (slurp "resources/oz/examples/vega/contour-lines.vega.json")))
6565
(oz/view! contour-plot :mode :vega)
6666

6767
;; Note that to publish vega, you must set :mode

0 commit comments

Comments
 (0)