REPL Workflow
Most cljure devs work with the REPL through a reloadable lifecycle system. If you don't know what a REPL workflow is I mandate that you read through REPL Driven Development and watch all the associated videos.
Pre requisites
npm install
- shadow-cljs will need the npm dependencies to compile the clojurescript to jsFrom root of shipclojure repo:
$ cp saas-secrets.example.edn resources/.dev-secrets.edn
to have development secrets ready for starting the REPL. After that make sure resources/.dev-secrets.edn
contain the correct secrets for development, especially the DB connection
See secrets management for more information
Clojure REPL
ShipClojure supports starting all of the dev-related processes through the REPL workflow. Integrant loads the runtime dependencies.
Steps:
Start the Clojure REPL using your editor's way of starting an NREPL server with the aliases
dev,test
(needed for development goodies).
$ bb repl-dev # starts the REPL with dev,test aliases for remote connection
When the REPL booted up call
(user/reset)
(or just(reset)
) directly from the REPL or from the namespace itself. If everything succeeded, you should see:resumed
in your REPL(Optional) Bind calling
(user/reset)
to a keybind so you can call it often as it is handy to reset your live dependencies. See this tweet for community explanations of binding a key to a clojure fn call - People in the replies contributed with the way to do it for most editors.Done! You have everything you need to start hacking on ShipClojure from clojure side.
ClojureScript REPL
NOTE: You don't need a CLJS REPL to work on shipclojure. Live reload of the changes in the .cljs files are already compiled and reflected in the browser. If that is enough for you, don't start a CLJS REPL. The CLJS REPL is a nice-to-have and useful for people who are used to it.
Before starting the ClojureScript REPL, you need start the clojure REPL and call (user/reset)
and see :resumed
in your REPL window.
The clojure REPL starts shadow-cljs REPL on port 7002. You can change the port this from the shadow-cljs.edn config file in the [:nrep :port]
section
Steps:
Use remote clojure connection to connect to the nREPL server started on localhost:7002
for emacs this means
Mx cider-connect-clj
and typing localhost:7002 when prompted for the repl addressfor intellij there is a run configuration already defined called
CLJS REPL
, just run that onefor VSCode
calva: Connect to Running REPL server, not in the project
, Select project typeGeneric
, addlocalhost:7002
when prompted forhostname:port
for VIM/NVIM please contact me to update the docs, I'm not familiar with this setup - basically you need to do a remote connection to a CLJ (not CLJS) nREPL on
localhost:7002
From the new connected REPL, call
(user/cljs-repl)
If everything worked correctly, you should see
[:selected :app]
You are done! You now have a running CLJ REPL and a CLJS repl
Last updated