This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-08
Channels
- # announcements (40)
- # babashka (14)
- # babashka-sci-dev (7)
- # beginners (50)
- # calva (8)
- # cider (25)
- # clj-kondo (7)
- # cljdoc (8)
- # cljs-dev (14)
- # clojars (6)
- # clojure (56)
- # clojure-australia (1)
- # clojure-berlin (2)
- # clojure-dev (16)
- # clojure-europe (18)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (7)
- # clojurescript (100)
- # cursive (57)
- # data-science (9)
- # datomic (6)
- # emacs (11)
- # figwheel (2)
- # fulcro (14)
- # helix (2)
- # hyperfiddle (9)
- # introduce-yourself (1)
- # lsp (20)
- # malli (14)
- # meander (34)
- # minecraft (1)
- # missionary (8)
- # off-topic (37)
- # pedestal (4)
- # polylith (18)
- # portal (3)
- # re-frame (5)
- # ring (33)
- # shadow-cljs (32)
- # spacemacs (6)
- # vim (16)
is there an :autorun
equivalent for :node-script
?
I want that in development, executing shadow-cljs watch :some-build
will automatically execute the resulting node script for the REPL runtime
there is not but can trivially achieve that with other tools, eg. https://www.npmjs.com/package/chokidar-cli
not sure this tool is what I was looking for, I'm using vscode calva to execute and connect the shadow-cljs.
So I need some kind of hook to execute the output at the end of the first build. I think I can use https://shadow-cljs.github.io/docs/UsersGuide.html#build-hooks, the question was mostly to make sure I'm not missing some built-in functionality like :autorun
...
there is no functionality for this. there are simply too many ways you might want to run a :node-script
yeah I totally understand the underling design, that's what I do today. Just trying to smooth things up for our team. I'll just hack my way through it 🙂
just use shadow-cljs node-repl
instead. that just gives you the REPL without any build config or so
I don't want just the REPL, I work on a project and want the project's runtime. I might misunderstand how the REPL work, but iiuc in order to work in my files, ns, functions and data I need to build, run and then connect to the script's\lib runtime, correct?
:node-script
builds your entire project and produces a "executable" which you can then run via node
node-repl
just gives you a REPL, in which you can (require 'your.code)
and run it, with no executable or other "output" apart from the REPL
So executing the output code is not necessary at all for dev? Mostly I just want node\browser repl and start hacking? I'm guessing a real browser is required only for experimenting with real application...
for example with :node-script
you might be doing something that takes command line arguments, executes and exits
having a REPL here would keep the process alive and would actually hinder the development
browser-repl only gives you a very basic HTML, that for example you can't include CSS into
yes, you can just use browser/node-repl to start hacking. whether or not that makes sense depends on what you are building
Yes, I just noticed that and started looking for a solution, I love the hot-reload 🙂
Hallo. I am trying to use the npm package https://www.npmjs.com/package/leader-line. It just defines the constructor LeaderLine
. The source for leader-line.min.js looks like this:
var LeaderLine=function(){...}();
But how do I use it in my ClojureScript code? (:require ["leader-line" :as leader-line])
gives me a JavaScript object, but it is no function and it has no .-LeaderLine
property.
JavaScript Console shows:
{}
[[Prototype]]: Object
constructor: Æ’ Object()
hasOwnProperty: Æ’ hasOwnProperty()
isPrototypeOf: Æ’ isPrototypeOf()
propertyIsEnumerable: Æ’ propertyIsEnumerable()
toLocaleString: Æ’ toLocaleString()
toString: Æ’ toString()
valueOf: Æ’ valueOf()
__defineGetter__: Æ’ __defineGetter__()
__defineSetter__: Æ’ __defineSetter__()
__lookupGetter__: Æ’ __lookupGetter__()
__lookupSetter__: Æ’ __lookupSetter__()
__proto__: (...)
get __proto__: Æ’ __proto__()
set __proto__: Æ’ __proto__()
When I include the library via <script src="...">
I can call (js/LeaderLine e1 e2)
. But js/LeaderLine
does not exist when I just (:require ["leader-line"])
so probably just (:require ["leader-line" :as leader-line])
and (leader-line.)
, ie. constructing a new instance?