Skip to content

Commit

Permalink
Notebook with SCI + js/import (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude authored Dec 10, 2024
1 parent 73c6a50 commit 63f6966
Show file tree
Hide file tree
Showing 6 changed files with 797 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ jobs:
- name: 📓 Build Clerk Book
run: |
cp notebooks/editor.clj editor.clj
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"]'
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"]'
- name: 📠 Copy book to bucket under SHA
run: |
gsutil cp -r public/build gs://nextjournal-snapshots/clerk/book/${{ github.sha }}
- name: 🏗 Build Clerk Static App with default Notebooks
run: clojure -J-Dclojure.main.report=stderr -X:demo:nextjournal/clerk :package :single-file
run: clojure -J-Dclojure.main.report=stderr -X:demo:sci:nextjournal/clerk :package :single-file

- name: 📠 Copy static build to bucket under SHA
run: |
Expand Down
7 changes: 3 additions & 4 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@
org.clojure/data.csv {:mvn/version "1.0.0"}
hickory/hickory {:mvn/version "0.7.1"}
org.mentat/emmy {:mvn/version "0.32.0"
:exclusions [org.babashka/sci]}
;; emmy needs SCI, here we use the same version as in render:
org.babashka/sci {:git/url "https://github.com/babashka/sci"
:git/sha "c556f4474303c61da72e7a07eef496dcbf66a56e"}
:exclusions [org.babashka/sci]
;; use :sci alias in addition to this
}
io.github.nextjournal/clerk-slideshow {:git/sha "11a83fea564da04b9d17734f2031a4921d917893"}}}

:nextjournal/garden {:exec-fn nextjournal.clerk/serve!
Expand Down
15 changes: 15 additions & 0 deletions notebooks/sci_import_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(ns sci-import-test
(:require [nextjournal.clerk :as clerk]
[clojure.core :as b]))

(clerk/with-viewer
{:render-fn
'(fn [_]
(nextjournal.clerk.render/render-promise
(->
(js/import "https:/esm.sh/[email protected]/index.mjs")
(.then
(fn [lib]
(nextjournal.clerk/html
[:pre (lib.formatRelative (lib.subDays (js/Date.) 2) (js/Date.))]))))))}
nil)
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"w3c-keyname": "2.2.4"
},
"devDependencies": {
"process": "^0.11.10"
"process": "^0.11.10",
"shadow-cljs": "^2.28.20"
}
}
5 changes: 3 additions & 2 deletions render/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
:deps {applied-science/js-interop {:mvn/version "0.3.3"}
binaryage/devtools {:mvn/version "1.0.3"}
cider/cider-nrepl {:mvn/version "0.28.3"}
org.babashka/sci {:git/url "https://github.com/babashka/sci"
:git/sha "c556f4474303c61da72e7a07eef496dcbf66a56e"}
org.babashka/sci #_{:local/root "../../babashka/sci"}
{:git/url "https://github.com/babashka/sci"
:git/sha "1e15f0f6a129ef7512351efc65f7475209d8cc4c"}
org.clojure/clojurescript {:mvn/version "1.11.132"}
io.github.babashka/sci.nrepl {:mvn/version "0.0.2"}
reagent/reagent {:mvn/version "1.2.0"}
Expand Down
Loading

0 comments on commit 63f6966

Please sign in to comment.