wip
This commit is contained in:
parent
de54410669
commit
b152ddf7ea
4 changed files with 22 additions and 9 deletions
16
README.md
16
README.md
|
|
@ -18,8 +18,24 @@ See [releases](https://github.com/babashka/scittle/releases) for links to
|
||||||
To connect to a Scittle REPL from your editor, scittle provides an nREPL
|
To connect to a Scittle REPL from your editor, scittle provides an nREPL
|
||||||
implementation. To run the nREPL server you need to follow these steps:
|
implementation. To run the nREPL server you need to follow these steps:
|
||||||
|
|
||||||
|
In babashka or Clojure JVM, use the
|
||||||
|
[sci.nrepl](https://github.com/babashka/sci.nrepl) dependency and run:
|
||||||
|
|
||||||
|
```
|
||||||
|
(require 'sci.nrepl.browser-server :as bp)
|
||||||
|
(bp/start! {:nrepl-port 1339 :websocket-port 1340})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This will run an nREPL server on port 1339 and a websocket server on port 1340.
|
||||||
|
Your editor's nREPL client will connect to port 1339 and your browser, running
|
||||||
|
scittle, will connect to port 1340.
|
||||||
|
|
||||||
|
In your scittle website, you will need to include the following, in addition to
|
||||||
|
the normal routine:
|
||||||
|
|
||||||
|
```
|
||||||
|
<script>var SCITTLE_NREPL_WEBSOCKET_PORT = 1340;</script>
|
||||||
|
<script src="js/scittle.nrepl.js" type="application/javascript"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Tasks
|
## Tasks
|
||||||
|
|
|
||||||
11
bb.edn
11
bb.edn
|
|
@ -1,6 +1,6 @@
|
||||||
{:deps {io.github.babashka/sci.nrepl
|
{:deps {io.github.babashka/sci.nrepl
|
||||||
;; {:local/root "../sci.nrepl"}
|
{:local/root "../sci.nrepl"}
|
||||||
{:git/sha "318e39fc356652d749180f3a3efba5eb4b99d304"}}
|
#_{:git/sha "318e39fc356652d749180f3a3efba5eb4b99d304"}}
|
||||||
|
|
||||||
:tasks
|
:tasks
|
||||||
{:requires ([babashka.fs :as fs]
|
{:requires ([babashka.fs :as fs]
|
||||||
|
|
@ -16,11 +16,8 @@
|
||||||
:task (clojure "-M:dev -m shadow.cljs.devtools.cli watch main")}
|
:task (clojure "-M:dev -m shadow.cljs.devtools.cli watch main")}
|
||||||
|
|
||||||
browser-nrepl {:doc "Start browser nREPL"
|
browser-nrepl {:doc "Start browser nREPL"
|
||||||
:requires ([sci.nrepl.browser-proxy :as bp])
|
:requires ([sci.nrepl.browser-server :as bp])
|
||||||
:task (do (bp/start-browser-nrepl! {:port 1339})
|
:task (bp/start! {})}
|
||||||
(bp/serve! {:port 1340})
|
|
||||||
(println "Started browser nREPL on port 1339")
|
|
||||||
(deref (promise)))}
|
|
||||||
|
|
||||||
-dev {:depends [shadow:watch browser-nrepl]}
|
-dev {:depends [shadow:watch browser-nrepl]}
|
||||||
|
|
||||||
|
|
|
||||||
2
deps.edn
2
deps.edn
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
io.github.babashka/sci.nrepl
|
io.github.babashka/sci.nrepl
|
||||||
#_{:local/root "../sci.nrepl"}
|
#_{:local/root "../sci.nrepl"}
|
||||||
{:git/sha "8998f2a4fd25ff02474d7298253e91f059f482b2"}}
|
{:git/sha "e83421ce9349c36df56a2eb936196dbb65b0de63"}}
|
||||||
|
|
||||||
:aliases
|
:aliases
|
||||||
{:dev
|
{:dev
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
:complete (let [completions (completions (assoc msg :ctx @!sci-ctx))]
|
:complete (let [completions (completions (assoc msg :ctx @!sci-ctx))]
|
||||||
(nrepl-reply msg completions))))
|
(nrepl-reply msg completions))))
|
||||||
|
|
||||||
(when (.-SCITTLE_BROWSER_REPL_PROXY_PORT js/window)
|
(when (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window)
|
||||||
(set! (.-ws_nrepl js/window)
|
(set! (.-ws_nrepl js/window)
|
||||||
(new js/WebSocket "ws://localhost:1340/_nrepl")))
|
(new js/WebSocket "ws://localhost:1340/_nrepl")))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue