REPL Workflow
Last updated
Last updated
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 and watch all the associated videos.
npm install
- shadow-cljs will need the npm dependencies to compile the clojurescript to js
From root of shipclojure repo:
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 for more information
ShipClojure supports starting all of the dev-related processes through the REPL workflow. 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).
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 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.
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.
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 address
for intellij there is a run configuration already defined called CLJS REPL
, just run that one
for VSCode calva: Connect to Running REPL server, not in the project
, Select project type Generic
, add localhost:7002
when prompted for hostname: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
The clojure REPL starts REPL on port 7002. You can change the port this from the config file in the [:nrep :port]
section