This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-21
Channels
- # adventofcode (82)
- # bangalore-clj (1)
- # beginners (44)
- # boot (7)
- # boot-dev (25)
- # cider (1)
- # cljs-dev (3)
- # cljsrn (14)
- # clojars (11)
- # clojure (210)
- # clojure-dusseldorf (4)
- # clojure-gamedev (2)
- # clojure-greece (11)
- # clojure-italy (6)
- # clojure-norway (6)
- # clojure-russia (6)
- # clojure-serbia (2)
- # clojure-spec (43)
- # clojure-sweden (1)
- # clojure-uk (77)
- # clojurescript (43)
- # cursive (1)
- # data-science (3)
- # datomic (32)
- # duct (3)
- # figwheel (2)
- # fulcro (71)
- # graphql (3)
- # hoplon (14)
- # jobs-discuss (3)
- # lambdaisland (1)
- # leiningen (2)
- # luminus (2)
- # lumo (14)
- # off-topic (16)
- # om-next (1)
- # perun (5)
- # random (1)
- # re-frame (19)
- # reagent (37)
- # ring-swagger (3)
- # shadow-cljs (157)
- # specter (6)
- # sql (29)
- # unrepl (14)
@thheller i'd like to help with the documentation writing effort, how can i get started?
by which i mean, are there things in particular that you'd like documented but never have the time to document?
Exception in thread "main" clojure.lang.ExceptionInfo: missing instance {}
at clojure.core$ex_info.invokeStatic(core.clj:4739)
at clojure.core$ex_info.invoke(core.clj:4739)
at shadow.cljs.devtools.server.runtime$get_instance_BANG_.invokeStatic(runtime.clj:11)
at shadow.cljs.devtools.server.runtime$get_instance_BANG_.invoke(runtime.clj:8)
at shadow.cljs.devtools.api$get_or_start_worker.invokeStatic(api.clj:104)
at shadow.cljs.devtools.api$get_or_start_worker.invoke(api.clj:99)
at shadow.cljs.devtools.api$watch.invokeStatic(api.clj:125)
at shadow.cljs.devtools.api$watch.invoke(api.clj:111)
at shadow.cljs.devtools.api$watch.invokeStatic(api.clj:115)
at shadow.cljs.devtools.api$watch.invoke(api.clj:111)
at build.watch$_main.invokeStatic(watch.clj:12)
at build.watch$_main.invoke(watch.clj:8)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.main$main_opt.invokeStatic(main.clj:317)
at clojure.main$main_opt.invoke(main.clj:313)
at clojure.main$main.invokeStatic(main.clj:424)
at clojure.main$main.doInvoke(main.clj:387)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.main.main(main.java:37)
@seako cool! I want to document all the things. I never know what to document since I wrote the thing and know how everything works. Anything helps really.
@jiyinyiyong in clj call (api/with-runtime (api/watch ...))
if you want a short lived runtime. (shadow.cljs.devtools.server/start!)
if you want to start and leave it running in the background.
2 | (ns app.updater (:require [respo.cursor :refer [mutate]]))
3 |
4 | (defn updater [store op op-data]
5 | (case op
---------^----------------------------------------------------------------------
Cannot infer target type in expression (. G__35616 -fqn)
--------------------------------------------------------------------------------
6 | :states (update store :states (mutate op-data))
7 | :content (assoc store :content op-data)
8 | store))
=>> clj -m build.compile
Exception in thread "main" java.lang.AssertionError: Assert failed: (map? http)
at shadow.cljs.devtools.server.worker$start.invokeStatic(worker.clj:106)
at shadow.cljs.devtools.server.worker$start.invoke(worker.clj:106)
at shadow.cljs.devtools.server.supervisor$start_worker.invokeStatic(supervisor.clj:30)
at shadow.cljs.devtools.server.supervisor$start_worker.invoke(supervisor.clj:23)
at shadow.cljs.devtools.api$get_or_start_worker.invokeStatic(api.clj:108)
at shadow.cljs.devtools.api$get_or_start_worker.invoke(api.clj:99)
at shadow.cljs.devtools.api$watch.invokeStatic(api.clj:125)
at shadow.cljs.devtools.api$watch.invoke(api.clj:111)
at shadow.cljs.devtools.api$watch.invokeStatic(api.clj:115)
at shadow.cljs.devtools.api$watch.invoke(api.clj:111)
at build.compile$_main$body_fn__29460__auto____31659.invoke(compile.clj:9)
at build.compile$_main.invokeStatic(compile.clj:8)
at build.compile$_main.invoke(compile.clj:7)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.main$main_opt.invokeStatic(main.clj:317)
at clojure.main$main_opt.invoke(main.clj:313)
at clojure.main$main.invokeStatic(main.clj:424)
at clojure.main$main.doInvoke(main.clj:387)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.main.main(main.java:37)
(ns build.compile
(:require [shadow.cljs.devtools.api :as api]
[shadow.cljs.devtools.server :as server]
[clojure.java.shell :refer [sh]]))
(defn -main []
(api/with-runtime
(api/watch :browser)))
I really would not recommend running shadow-cljs via clj
. it is just strictly worse than using shadow-cljs
directly
they look same too me. guess I don't need to duplicate deps in deps.edn
if I call shadow-cljs clj-run
it resolves differently than lein
or boot
. don’t know why … it is alpha so be careful.
just pushed [email protected]
which should start a bit faster. if you already have ssl configured it now supports http2 as well.
@thheller You mentioned in the cljs channel that shadow-cljs has support for using dependencies from npm. Is there a minimal example somewhere of how to require those dependencies in clojurescript code? Should it work the way clojurescript's :npm-deps is supposed to?
@tomc https://code.thheller.com/blog/shadow-cljs/2017/11/10/js-dependencies-in-practice.html
:npm-deps
is supported when libs use it. in your project you directly npm install
(or yarn
) yourself
:npm-deps
should also work for your own project, no? that’s what i have been doing.. then my libs/apps are consistent
minimal example you can clone https://github.com/shadow-cljs/quickstart-browser and use that as a quickstart
shadow-cljs - config: /Users/chen/repo/mvc-works/coworkflow/shadow-cljs.edn version: 2.0.122
shadow-cljs - starting ...
Exception in thread "main" java.lang.AssertionError: Assert failed: (map? http)
at shadow.cljs.devtools.server.worker$start.invokeStatic(worker.clj:106)
at shadow.cljs.devtools.server.worker$start.invoke(worker.clj:106)
at shadow.cljs.devtools.server.supervisor$start_worker.invokeStatic(supervisor.clj:30)
at shadow.cljs.devtools.server.supervisor$start_worker.invoke(supervisor.clj:23)
at shadow.cljs.devtools.api$get_or_start_worker.invokeStatic(api.clj:95)
at shadow.cljs.devtools.api$get_or_start_worker.invoke(api.clj:86)
at shadow.cljs.devtools.api$watch.invokeStatic(api.clj:112)
at shadow.cljs.devtools.api$watch.invoke(api.clj:98)
at shadow.cljs.devtools.api$watch.invokeStatic(api.clj:102)
at shadow.cljs.devtools.api$watch.invoke(api.clj:98)
at build.watch$_main.invokeStatic(watch.clj:9)
at build.watch$_main.invoke(watch.clj:7)
(ns build.watch
(:require [shadow.cljs.devtools.api :as api]
[shadow.cljs.devtools.server :as server]
[clojure.java.shell :refer [sh]]))
(defn -main []
(server/start!)
(api/watch :browser))
so the issue is that clj-run
only does a with-runtime
which is a lightweight runtime that doesn’t start the embedded server
I think a case came up this week where I thought “hey, we might need to move our watch command into a clj-run process)” but i can’t remember the exact context right now.
ah, remembered one. I’m adding a function to my release script which rewrites asset paths in index.html
to match the MD5 output names in manifest.edn
. I’d like to make sure these paths get re-written to their base forms during dev. I’m trying to think of the most logical way to do this… what came to mind is using clj-run
to run my-app.build/watch
, and in that function, call the write-static-resource-paths!
function once, after the initial compile of api/watch
.
I can make it work easily but it does require you managing threads which is not very fun
"del": "rm -rf dist/*",
"release": "shadow-cljs release browser",
"compile-ssr": "shadow-cljs compile ssr",
"html": "node target/ssr.js && cp entry/manifest.json dist/",
"build": "yarn del && yarn release && yarn compile-ssr && yarn html"
never mind, actually I would use shadow-cljs
command line, if launching it from Clojure is not better.
there are several things I can do … just need to figure out which makes the most sense
(ns build.release
(:require [shadow.cljs.devtools.api :as api]
[shadow.cljs.devtools.server :as server]
[clojure.java.shell :refer [sh]]))
(defn -main []
(println (sh "rm" "-rf" "dist/*"))
(api/with-runtime (api/release :browser))
(api/with-runtime (api/compile :ssr))
(println (sh "node" "target/ssr.js"))
(println (sh "cp" "entry/manifest.json" "dist/")))
you can invoke functions directly with clj-run
, makes things much easier to organize imho
(defn release []
(println (sh "rm" "-rf" "dist/*"))
(api/release :browser)
(api/compile :ssr)
(println (sh "node" "target/ssr.js"))
(println (sh "cp" "entry/manifest.json" "dist/")))
so api/watch
starts a background thread. its basically an async
function. it returns as soon as the first compile completes
Exception in thread "main" java.lang.AssertionError: Assert failed: (map? http)
at shadow.cljs.devtools.server.worker$start.invokeStatic(worker.clj:106)
at shadow.cljs.devtools.server.worker$start.invoke(worker.clj:106)
at shadow.cljs.devtools.server.supervisor$start_worker.invokeStatic(supervisor.clj:30)
still want to figure you what you are trying to do exactly to see if I can make things easier
not yet. I want to add it eventually. didn’t even know about the mvn
stuff but that seems to work
I added a note about a lein deps :tree
to a new “FAQ” page, as I wasn’t sure where else to put it: https://github.com/thheller/shadow-cljs/wiki/FAQ
I also added the ‘Production Builds’ and FAQ pages to the sidebar, and re-organized it a bit.
I’d like to do something to the ‘Home’ page, because it gives the impression of the wiki being empty (unless you know to look at the sidebar)
I want to work on the docs in the next few days as well but all suggestions are welcome
feel free to do whatever to the wiki, I really have no idea how to structure it myself
I added a note about a lein deps :tree
to a new “FAQ” page, as I wasn’t sure where else to put it: https://github.com/thheller/shadow-cljs/wiki/FAQ