This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-23
Channels
- # bangalore-clj (5)
- # beginners (136)
- # boot (1)
- # bristol-clojurians (6)
- # cider (46)
- # cljs-dev (172)
- # cljsrn (35)
- # clojure (82)
- # clojure-china (2)
- # clojure-dev (9)
- # clojure-dusseldorf (1)
- # clojure-finland (15)
- # clojure-italy (54)
- # clojure-norway (4)
- # clojure-russia (6)
- # clojure-spec (19)
- # clojure-uk (61)
- # clojurebridge (1)
- # clojurescript (55)
- # community-development (23)
- # cursive (7)
- # datomic (19)
- # emacs (10)
- # events (4)
- # fulcro (108)
- # graphql (7)
- # hoplon (1)
- # leiningen (7)
- # lumo (14)
- # off-topic (68)
- # onyx (23)
- # parinfer (8)
- # portkey (40)
- # precept (11)
- # re-frame (5)
- # reagent (40)
- # ring-swagger (5)
- # shadow-cljs (58)
- # specter (5)
- # tools-deps (37)
- # unrepl (13)
- # vim (9)
- # yada (12)
Is there a good full walkthrough/tutorial of making an app with shadow-cljs?
@joshua.d.horwitz there is the user guide of course and there is also this starter repo https://github.com/lauritzsh/reagent-shadow-cljs-starter
actually this quickstart might be better https://github.com/shadow-cljs/quickstart-browser
Thank you!
I know Clojure decently and just trying to find where to get intro ClojureScript and start using it
that’ll help with the tooling. for actually learning the language, the only hard part is getting your head wrapped around a single threaded language. then you need to pick a tech stack (fun!)
I'm following the quickstart browser and I'm getting this when I do the release
------ WARNING #1 --------------------------------------------------------------
File: cljs/core.cljs:37412:13
variable Java is undeclared
--------------------------------------------------------------------------------
So, @thheller. I’m seeing code generation differences that break fulcro spec’s use of with-redefs
. Instead of generated code calling functions like this:
fulcro.ui.forms.form_reduce.call(null,root_form,...)
shadow is generating:
fulcro.ui.forms.form_reduce.cljs$core$IFn$_invoke$arity$3(root_form,...
Then the use of with-redefs
redefines fulcro.ui.forms.form_reduce
to a function, and we end up with errors like this:
fulcro.ui.forms.form_reduce.cljs$core$IFn$_invoke$arity$3 is not a function
I can see that this looks like an optimization, but it definitely breaks code that has been working against clj and cljs for years. Seems to me it generally breaks cljs with-redefs
@thheller tried making a minimal case with the thing we were puzzling over with @tony.kay. Not sure if I found the same thing because this time i’m getting an actual error. Posted an issue: https://github.com/thheller/shadow-cljs/issues/225
@tony.kay that is probably broken because shadow-cljs defaults to :static-fns true
. can you trying compiling with :compiler-options {:static-fns false}
?
Ah I see. I have seen that compiler option before. I guess I didn't expect it to break core functions.
@tony.kay I have this issue thats bugging me about om/fulcro query setup. the point of query language like graphql to me is that components just ask for what they want and don't have to worry where the underlying data is coming from (or its shape)
yet in om/fulcro the components ALSO basically define the database schema via idents
but the components shouldn't be the ones deciding how the normalization happens in my mind
I guess I might just need to use fulcro more and let it sink in but every time this nagging feeling just keeps coming up
hey guys is there an existing idiom for module-hash-names and your index.html file management?
initially I was thinking of writing something that fetches the manifest.json, then dynamically adds a script tag to fetch my actual code source by parsing the name out of the manifest
but that adds quite a bit of overhead right at the app load time, so preferably a compile-time solution already exists
if its static you could use https://shadow-cljs.github.io/docs/UsersGuide.html#clj-run
(ns your.build
(:require
[shadow.cljs.devtools.api :as shadow]
[clojure.edn :as edn]
[clojure.string :as str]))
(defn release []
(shadow/release :your-build)
(let [manifest
(-> (slurp "public/js/manifest.edn")
(edn/read-string))
index-src
(slurp "public/index.html.src")
index
(reduce
(fn [index-src {:keys [module-id output-name]}]
(let [marker (str (name module-id) ".js")]
(str/replace index-src marker output-name)))
index-src
manifest)]
(spit "public/index.html" index)))
I’m having difficulty with the related (shadow/watch) api. is there something different about the expectations of this fn?
some complaints about “Exception in thread “main” java.lang.AssertionError: Assert failed: (map? http)
at shadow.cljs.devtools.server.worker$start.invokeStatic(worker.clj:103)” when I try to do (shadow/watch (keyword build-id)
where build-id is provided as a string from the cli
looks at a public/index.html.src
replaces <srcipt src="/js/main.js">
with <srcipt src="/js/main.<the-hash>.js">
pretty hacky but should work. could make it more reliable by using better placeholder or something like that
i had something like the above-- or rather, was writing something like that right now. i guess my next question is: is there a way to use a pre-hook so I can shadow-cljs
… oh wait
indeed. thats the same as calling shadow-cljs release your-build
just from the clojure api
i would have thought I could use a :pre-hook and maintain shadow-cljs release prod
, and in that release hook templating would take place
yea thanks for this; ill use the clj-run which will also allow me pass command line args, tightening up the above “hacky” solution a bit
does this error make any sense to you? I am masochistically trying to get my shadow builds working everywhere, this time during slug compilation on heroku.
remote: > shadow-cljs start && shadow-cljs clj-run build.build/release && webpack -p;
remote:
remote: shadow-cljs - config: /tmp/build_248d245eeae37c14789671b54890ae63/_spark-spa/shadow-cljs.edn version: 2.2.14
remote: shadow-cljs - server starting .events.js:160
remote: throw er; // Unhandled 'error' event
remote: ^
remote:
remote: Error: spawn clojure ENOENT
remote: at exports._errnoException (util.js:1026:11)
remote: at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
remote: at onErrorNT (internal/child_process.js:348:16)
remote: at _combinedTickCallback (internal/process/next_tick.js:74:11)
remote: at process._tickCallback (internal/process/next_tick.js:98:9)
remote: at Module.runMain (module.js:592:11)
remote: at run (bootstrap_node.js:394:7)
remote: at startup (bootstrap_node.js:149:9)
remote: at bootstrap_node.js:509:3
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
(I switched to shadow-cljs start && shadow-cljs release...
because shadow-cljs release...
doesn’t fail, it just prints “starting with clojure” and then heroku silently moves on to the next process and nothing is compiled)so, the following works to install clojure on heroku, assuming you are in the heroku/node
buildpack after the heroku/jvm
buildpack: curl -O
@thheller what do you think about a feature on the browser side that gives some like warning that you’ve disconnected from the shadow-cljs server and/or a feature that lets you know if the build is broken. sometimes you think you’re looking at live code but you’re not
maybe the simplest thing is to deal with disconnection: seems to me that a popup similar to the one that signals a recompilation which simply shoes the cljs logo and says “disconnected” would be enough. query: does shadow-cljs try to reload once disconnected? maybe it should keep retrying, which would eliminate the problem most of the time