Skip to content

Commit a7d8668

Browse files
committed
feat: add gen.sci, editable notebook
1 parent e97a93e commit a7d8668

File tree

10 files changed

+1258
-13
lines changed

10 files changed

+1258
-13
lines changed

DEVELOPING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,34 @@ bb release
6565

6666
The new release will appear on Clojars.
6767

68+
## Publishing JS
69+
70+
> **Note**
71+
> To publish `emmy-viewers` JS, you must be part of the [InferenceQL
72+
> GitHub organization](https://github.com/inferenceql).
73+
74+
- Create a classic personal access token with `read:org` permissions.
75+
- Add a line like this to your bash profile:
76+
77+
```bash
78+
export GITHUB_TOKEN="<your_token>"
79+
```
80+
81+
Run the following code with the `:nextjournal/clerk` alias activated:
82+
83+
```clojure
84+
(require '[mentat.clerk-utils.build :as b])
85+
86+
(b/release->cas!
87+
{:cljs-namespaces '[gen.sci-extensions]
88+
:cas-namespace "inferenceql"
89+
:prefix "gen.clj"
90+
:token (System/getenv "GITHUB_TOKEN")})
91+
```
92+
93+
- Take the resulting URL and replace the existing entry at
94+
`emmy.clerk/custom-js` with the new URL that prints.
95+
6896
## Linting
6997

7098
Code is linted with [`clj-kondo`](https://github.com/clj-kondo/clj-kondo):

dev/gen/sci_extensions.cljs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(ns gen.sci-extensions
2+
"SCI environment extensions, meant to apply to the Gen.clj Clerk documentation
3+
build."
4+
(:require [gen.sci]))
5+
6+
(gen.sci/install!)

dev/user.clj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(ns user
2-
(:require [nextjournal.clerk :as clerk]))
2+
(:require [gen.clerk :as clerk]))
33

44
(set! *warn-on-reflection* true)
55

@@ -8,10 +8,14 @@
88

99
(def notebooks
1010
["examples/introduction.clj"
11-
"examples/intro_to_modeling.clj"])
11+
"examples/intro_to_modeling.clj"
12+
"examples/intro_to_modeling/edit.clj"])
1213

1314
(def defaults
14-
{:index index})
15+
{:index index
16+
;; Enable / uncomment this when working on new components.
17+
;; :cljs-namespaces '[gen.sci-extensions]
18+
})
1519

1620
(def serve-defaults
1721
(assoc defaults
@@ -27,15 +31,11 @@
2731
(defn serve!
2832
([] (serve! {}))
2933
([opts]
30-
(let [{:keys [browse? index] :as opts} (merge serve-defaults opts)]
31-
(when (and browse? index)
32-
(clerk/show! index))
33-
(clerk/serve! opts))))
34+
(clerk/serve!
35+
(merge serve-defaults opts))))
3436

3537
(def halt! clerk/halt!)
3638

37-
(defn build!
38-
([] (build! {}))
39-
([opts]
40-
(clerk/build!
41-
(merge static-defaults opts))))
39+
(defn build! [opts]
40+
(clerk/build!
41+
(merge static-defaults opts)))

0 commit comments

Comments
 (0)