Skip to content

Commit

Permalink
feat: add gen.sci, editable notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
sritchie committed Oct 2, 2023
1 parent e97a93e commit a7d8668
Show file tree
Hide file tree
Showing 10 changed files with 1,258 additions and 13 deletions.
28 changes: 28 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,34 @@ bb release

The new release will appear on Clojars.

## Publishing JS

> **Note**
> To publish `emmy-viewers` JS, you must be part of the [InferenceQL
> GitHub organization](https://github.com/inferenceql).
- Create a classic personal access token with `read:org` permissions.
- Add a line like this to your bash profile:

```bash
export GITHUB_TOKEN="<your_token>"
```

Run the following code with the `:nextjournal/clerk` alias activated:

```clojure
(require '[mentat.clerk-utils.build :as b])

(b/release->cas!
{:cljs-namespaces '[gen.sci-extensions]
:cas-namespace "inferenceql"
:prefix "gen.clj"
:token (System/getenv "GITHUB_TOKEN")})
```

- Take the resulting URL and replace the existing entry at
`emmy.clerk/custom-js` with the new URL that prints.

## Linting

Code is linted with [`clj-kondo`](https://github.com/clj-kondo/clj-kondo):
Expand Down
6 changes: 6 additions & 0 deletions dev/gen/sci_extensions.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(ns gen.sci-extensions
"SCI environment extensions, meant to apply to the Gen.clj Clerk documentation
build."
(:require [gen.sci]))

(gen.sci/install!)
24 changes: 12 additions & 12 deletions dev/user.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns user
(:require [nextjournal.clerk :as clerk]))
(:require [gen.clerk :as clerk]))

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

Expand All @@ -8,10 +8,14 @@

(def notebooks
["examples/introduction.clj"
"examples/intro_to_modeling.clj"])
"examples/intro_to_modeling.clj"
"examples/intro_to_modeling/edit.clj"])

(def defaults
{:index index})
{:index index
;; Enable / uncomment this when working on new components.
;; :cljs-namespaces '[gen.sci-extensions]
})

(def serve-defaults
(assoc defaults
Expand All @@ -27,15 +31,11 @@
(defn serve!
([] (serve! {}))
([opts]
(let [{:keys [browse? index] :as opts} (merge serve-defaults opts)]
(when (and browse? index)
(clerk/show! index))
(clerk/serve! opts))))
(clerk/serve!
(merge serve-defaults opts))))

(def halt! clerk/halt!)

(defn build!
([] (build! {}))
([opts]
(clerk/build!
(merge static-defaults opts))))
(defn build! [opts]
(clerk/build!
(merge static-defaults opts)))
Loading

0 comments on commit a7d8668

Please sign in to comment.