This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-11
Channels
- # aleph (1)
- # beginners (192)
- # boot (9)
- # cider (12)
- # cljs-dev (223)
- # clojure (30)
- # clojure-brasil (3)
- # clojure-china (1)
- # clojure-italy (4)
- # clojure-russia (24)
- # clojure-spec (7)
- # clojured (5)
- # clojurescript (82)
- # cursive (9)
- # datomic (24)
- # emacs (6)
- # fulcro (9)
- # keechma (1)
- # luminus (1)
- # off-topic (3)
- # om-next (5)
- # onyx (1)
- # parinfer (9)
- # re-frame (1)
- # reitit (4)
- # ring-swagger (6)
- # shadow-cljs (8)
- # spacemacs (1)
- # sql (1)
- # unrepl (13)
Any obvious gotchas for the {:figwheel {:on-jsload "some.thing/here" }} config not working? I get the little clojurescript icon flash, so it looks like the new code is being pushed down the wire, but it's not re-rendering the view. I can call the function from a cljs repl and it works with no issue.
make sure it's a function and not the result of calling the function
I understand there are some changes to running cljs, but I'm not sure what they are. Is this qs reflective of the changes? https://clojurescript.org/guides/quick-start
Does it still depend on Java? Someone said you don't need to run Java directly but I didn't understand what that meant
@drewverlee ClojureScript requires Java unless you’re using bootstrapped - i.e. Planck or Lumo (independently installable)
Planck is self-contained I think now? (\cc @mfikes), Lumo needs Node.js (I guess it’s self contained too)
@drewverlee these options are popular for scripting as they start fast- but most app dev is happening via ClojureScript that runs against JVM
most? are you aware of any modern setups for building full Node web apps that avoid the JVM with Lumo/etc? Are people just using the Lumo build API directly and gluing it together with component
and/or other custom scripts?
@U3HMZGQ3S I haven’t been following Lumo app dev so I can’t say, might want to check #lumo
@drewverlee You are probably referring to the changes in this draft of Quick Start, where you can see that you no longer type java
to run things (unless on Windows, but that will ultimately change too): https://github.com/clojure/clojurescript-site/blob/quick-start-1.10/content/guides/quick-start.adoc
I’m trying the new 1.10 cljs quickstart and tried to compile this file: https://github.com/lambdaisland/birch/blob/master/src/birch/core.cljs with target node:
clj -m cljs.main --target node --output-to main.js -c hello-world.core
I end up with a file that does nothing when executed. It doesn’t include the -main
function. Where can I find what to do in this case on the clojurescript website?This is my deps.edn:
{:deps
{org.clojure/clojurescript {:git/url “”
:sha “2f233d633f6dc44823105fd544685fc4da43ac6c”
}
org.clojure/tools.cli {:mvn/version “0.3.5”}}
}
if you want to compile something that just runs you need kick it off yourself in the source
yeah:
clj -m cljs.main -re node -m hello-world.core "."
WARNING: Use of undeclared Var hello-world.core/-main in file <cljs repl>
...
that worked (don’t know what the warning is about)@borkdude cljs.core/*main-cli-fn*
is also a thing, if you set that then when you compile -c
w/ -t node
then whatever you set that dyn var to will be invoked
How do I get everything inside with main.js file without any references to the out folder?
I tried clj -m cljs.main --target node --output-to main.js -c hello-world.core -O simple
but that didn’t work for me
@borkdude If you end up seeing improvements to the draft instructions here, I could incorporate them. One change I'll make is to simply output to main.js
without a path. https://github.com/mfikes/clojurescript-site/blob/issue-177/content/news/2018-03-12-clojurescript-command-line.adoc#creating-a-node-app
Here is the associated PR as well https://github.com/clojure/clojurescript-site/pull/178
looks fine to me. Why post it as a news article, or will it also be included in guides/references?
With Reagent I’m always looking through several news posts to find the latest API additions and how they work 😉
Because the news post has a heavy emphasis on all the stuff you can do with cljs.main
(whereas Quick Start is trying to just get you going without illustrating all the neat stuff that cljs.main
can do)
Here are all the planned doc drafts. Feedback on the PRs welcome: https://gist.github.com/mfikes/bdbe214f03abac88ae384adb1ac26490
News article is great. But it’s also great to not have to dig through news articles to get the full picture is what I meant with my reference to Reagent
Right, there is a reference page as well. (News is ephemeral) https://github.com/mfikes/clojurescript-site/blob/issue-172/content/reference/repl-and-main.adoc#compiling-source
seems like cljs.main needs to take -m option instead of rebel readline. is there another way to invoke?
Just trying 1.10.145 with :nodejs in CIDER and it seems I get a "banner" ever time I eval???
cljs.user> :abc
ClojureScript 1.10.145
:abc
cljs.user> (+ 1 2 3)
ClojureScript 1.10.145
6
cljs.user>
@tmarble Fixed in master https://dev.clojure.org/jira/browse/CLJS-2640
cljs.user=> (hello-world.core/-main “foo” “bar”)
foobar
nil
cljs.user=> (require ’[hello-world.core :refer [-main]])
clojure.lang.ExceptionInfo: Invalid :refer, var hello-world.core/-main does not exist
you can do it yourself by making a main that wraps cljs.main with a rebel-readline, its a great exercise
@bhauman @dpsutton If you do this, it will bridge cljs.main
to rebel-readline with the browser REPL being the "inner" one:
clj -Sdeps '{:deps {github-mfikes/cljs-main-rebel-readline {:git/url "" :sha "262b801da65ec5260e295ed9a478084fa67e58cd"}}}' -i @/bridge.clj -m cljs.main -re rebel-readline-cljs
I'm working on how to pass in the inner REPL via a -ro
option, so if you want node
it will give you an wrapped Node REPL, for example.
I suspect it could be -re rebel-readline-cljs
with -ro {:wrapped-re "node"}
, but I haven't put much thought into it.
this of course looks differently to me because I designed rebel readline so that you can easily wrap it around anything
yeah I dunno, if you need to wrap repl-env then it won’t work in other interesting cases - i.e. Clojure/ClojureScript socket REPLs running under one VM via component or whatever
yeah you really want it to compose, otherwise you’ll write your own version of everything
@dpsutton This will run cljs.main
with Node, if you are interested in that variant
clj -Sdeps '{:deps {github-mfikes/cljs-main-rebel-readline {:git/url "" :sha "74ef9e83e5edd0421b468b581e4b03e8c74c497f"}}}' -i @/bridge.clj -m cljs.main -re rebel-readline-cljs
why does this happen? https://clojurians.slack.com/archives/C03S1L9DN/p1520800504000010
@mfikes @dpsutton clojure -e "(require 'cljs.repl)(require 'rebel-readline.cljs.repl)(let [cljs-repl cljs.repl/repl*] (alter-var-root #'cljs.repl/repl* (fn [x] (fn [env opts] (with-redefs [cljs.repl/repl* cljs-repl] (rebel-readline.cljs.repl/repl* env opts)))))nil)" -m cljs.main