Skip to content

Commit 63f6966

Browse files
authored
Notebook with SCI + js/import (#736)
1 parent 73c6a50 commit 63f6966

File tree

6 files changed

+797
-9
lines changed

6 files changed

+797
-9
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ jobs:
145145
- name: 📓 Build Clerk Book
146146
run: |
147147
cp notebooks/editor.clj editor.clj
148-
clojure -J-Dclojure.main.report=stderr -X:demo:nextjournal/clerk :git/sha '"${{ github.sha }}"' :git/url '"https://github.com/nextjournal/clerk"' :paths '["book.clj" "CHANGELOG.md" "editor.clj"]'
148+
clojure -J-Dclojure.main.report=stderr -X:demo:sci:nextjournal/clerk :git/sha '"${{ github.sha }}"' :git/url '"https://github.com/nextjournal/clerk"' :paths '["book.clj" "CHANGELOG.md" "editor.clj"]'
149149
150150
- name: 📠 Copy book to bucket under SHA
151151
run: |
152152
gsutil cp -r public/build gs://nextjournal-snapshots/clerk/book/${{ github.sha }}
153153
154154
- name: 🏗 Build Clerk Static App with default Notebooks
155-
run: clojure -J-Dclojure.main.report=stderr -X:demo:nextjournal/clerk :package :single-file
155+
run: clojure -J-Dclojure.main.report=stderr -X:demo:sci:nextjournal/clerk :package :single-file
156156

157157
- name: 📠 Copy static build to bucket under SHA
158158
run: |

deps.edn

+3-4
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@
8383
org.clojure/data.csv {:mvn/version "1.0.0"}
8484
hickory/hickory {:mvn/version "0.7.1"}
8585
org.mentat/emmy {:mvn/version "0.32.0"
86-
:exclusions [org.babashka/sci]}
87-
;; emmy needs SCI, here we use the same version as in render:
88-
org.babashka/sci {:git/url "https://github.com/babashka/sci"
89-
:git/sha "c556f4474303c61da72e7a07eef496dcbf66a56e"}
86+
:exclusions [org.babashka/sci]
87+
;; use :sci alias in addition to this
88+
}
9089
io.github.nextjournal/clerk-slideshow {:git/sha "11a83fea564da04b9d17734f2031a4921d917893"}}}
9190

9291
:nextjournal/garden {:exec-fn nextjournal.clerk/serve!

notebooks/sci_import_test.clj

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(ns sci-import-test
2+
(:require [nextjournal.clerk :as clerk]
3+
[clojure.core :as b]))
4+
5+
(clerk/with-viewer
6+
{:render-fn
7+
'(fn [_]
8+
(nextjournal.clerk.render/render-promise
9+
(->
10+
(js/import "https:/esm.sh/[email protected]/index.mjs")
11+
(.then
12+
(fn [lib]
13+
(nextjournal.clerk/html
14+
[:pre (lib.formatRelative (lib.subDays (js/Date.) 2) (js/Date.))]))))))}
15+
nil)

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"w3c-keyname": "2.2.4"
3737
},
3838
"devDependencies": {
39-
"process": "^0.11.10"
39+
"process": "^0.11.10",
40+
"shadow-cljs": "^2.28.20"
4041
}
4142
}

render/deps.edn

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
:deps {applied-science/js-interop {:mvn/version "0.3.3"}
33
binaryage/devtools {:mvn/version "1.0.3"}
44
cider/cider-nrepl {:mvn/version "0.28.3"}
5-
org.babashka/sci {:git/url "https://github.com/babashka/sci"
6-
:git/sha "c556f4474303c61da72e7a07eef496dcbf66a56e"}
5+
org.babashka/sci #_{:local/root "../../babashka/sci"}
6+
{:git/url "https://github.com/babashka/sci"
7+
:git/sha "1e15f0f6a129ef7512351efc65f7475209d8cc4c"}
78
org.clojure/clojurescript {:mvn/version "1.11.132"}
89
io.github.babashka/sci.nrepl {:mvn/version "0.0.2"}
910
reagent/reagent {:mvn/version "1.2.0"}

0 commit comments

Comments
 (0)