This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-03
Channels
- # beginners (111)
- # boot (1)
- # braveandtrue (4)
- # calva (2)
- # cider (16)
- # clara (35)
- # cljdoc (4)
- # cljs-dev (22)
- # clojure (80)
- # clojure-dev (17)
- # clojure-europe (3)
- # clojure-italy (57)
- # clojure-japan (1)
- # clojure-nl (4)
- # clojure-serbia (1)
- # clojure-spec (25)
- # clojure-uk (108)
- # clojurescript (67)
- # cursive (17)
- # data-science (5)
- # datascript (6)
- # datomic (6)
- # devcards (1)
- # events (1)
- # expound (13)
- # figwheel (2)
- # figwheel-main (6)
- # fulcro (7)
- # jobs-discuss (8)
- # kaocha (1)
- # luminus (3)
- # nrepl (6)
- # off-topic (58)
- # re-frame (1)
- # reitit (16)
- # remote-jobs (1)
- # ring (1)
- # shadow-cljs (70)
- # spacemacs (10)
- # sql (42)
- # testing (1)
- # tools-deps (8)
- # vim (1)
Can somebody help me understand why I need a watch to run a REPL? (Or maybe I'm misunderstanding that requirement?)
I'm having difficulty understanding the different options--`clj-repl`, cljs-repl
, node-repl
node-repl
seems like what I want but I don't understand what "It has access to all your code via the usual means." in the docs means.
@lilactown I am trying to develop an AWS Lambda node function. I need one dependency loaded (the AWS JS SDK).
I don't have any Clojurescript background, only Clojure. Most of the documentation I can find presumes a level of familiarity with third-party tools (node, npm, yarn) that I do not have.
(In production, the AWS lambda runtime automatically has the AWS SDK available, as I understand it. But I would like to also have it available locally in an instance with a REPL so I can iterate on my code without needing to deploy constantly)
so CLJS is different than Clojure, in that the process that takes Clojure code and turns it into something the platform executes is separate from the process it actually evaluates in
so the typical way of working on an application is to have a watch running (which is compiling your ClojureScript code) and a Node.js process running which is connected to that watch.
your REPL code then would go through that same compilation process before being sent to the Node.js process to be evaluated
@enn shadow-cljs node-repl
and then (require '["aws-sdk" :as aws])
should get you started without any watch
I get this error:
[0:0]~cljs.user=> (require '["aws-sdk" :as aws])
repl/require failed { Error: ENOENT: no such file or directory, open '/Users/elinaeher/clubhouse/backend/salesforce-lambda/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.js.shim.module$aws_sdk.js'
/Users/elinaeher/clubhouse/backend/salesforce-lambda
is that your project directory?
can you check the contents of the /Users/elinaeher/clubhouse/backend/salesforce-lambda/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime
directory? it should have a bunch of .js
files?
after installing aws-sdk with node I am able to require it in the CLI repl. If I connect with CIDER though I am not in a clojurescript repl and it doesn't work
are you one a weird network drive or some other non-standard filesystem that maybe doesn't like the $
?
I know basically nothing about CIDER so if things works without it I can't help much
I have tried basically that flow ... I don't understand this part though: https://shadow-cljs.github.io/docs/UsersGuide.html#_connect_the_javascript_environment
> If you haven’t already done so, connect a JavaScript runtime to the shadow-cljs server. For example, for browser development, browse to http://localhost:8080. What would the node equivalent be?
you can just run shadow-cljs node-repl
separately and select the :node-repl
build in cider
I don’t think it’s cider-connect-sibling-cljs
he wants, but cider-connect-cljs
https://cider.readthedocs.io/en/latest/clojurescript/#using-shadow-cljs
Leaving CIDER out of it for now, I am still having problems connecting a watch and a repl
$ shadow-cljs watch app
shadow-cljs - config: /Users/elinaeher/clubhouse/backend/salesforce-lambda/shadow-cljs.edn cli version: 2.8.36 node: v8.11.3
shadow-cljs - server version: 2.8.36 running at
shadow-cljs - nREPL server started on port 61441
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (44 files, 2 compiled, 0 warnings, 1.24s)
$ shadow-cljs cljs-repl app
shadow-cljs - config: /Users/elinaeher/clubhouse/backend/salesforce-lambda/shadow-cljs.edn cli version: 2.8.36 node: v11.12.0
shadow-cljs - connected to server
[1:1]~cljs.user=> (require '["aws-sdk" :as aws])
No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
[1:1]~cljs.user=>
watch
doesn't manage your node
process. so you need to run node <the-output-to>.js
manually
Do I need to restart node when the output file changes or does node automatically reload?
What does reload mean in this context, do you want to launch the process again? If that's the case then Thomas' solution is the best (or use nodemon
). However if you want more of a REPL-driven development you can keep the process going and shadow will reload the namespaces for you. Am I right @thheller? Hopefully 😃
to use node-repl with cider:
1. run shadow-cljs node-repl
2. wait for nREPL server started on port <x>
3. In Emacs, M-x cider-connect
and do localhost
, port <x>
4. Once in the CLJ REPL, run (shadow/repl :node-repl)
OK. That works, but CIDER does not register that it is a CLJS REPL. However, if I start it with cider-jack-in-cljs
per the link that @emoarmy posted, and run node target/main.js
separately, it does work and CIDER does pick on it being a CLJS REPL. Thank you for your help, everyone.
I'm using a PixelBook with Google's linux VM "Crostini". I believe I need browsers to use penguin.linux.test
as a host instead of localhost
for websocket connections. Is there setting that I can use to change the websocket host with shadow-cljs?