arachne

Project Page: http://arachne-framework.org/ Kickstarter: https://www.kickstarter.com/projects/1346708779/arachne-rapid-web-development-for-clojure
jcf 2018-01-26T17:53:16.000715Z

Anyone got a solution to this:

Uncaught TypeError: goog.net.jsloader.load is not a function
    at figwheel$client$file_reloading$reload_file_in_html_env (file_reloading.cljs?rel=1516980062278:208)
    at figwheel$client$file_reloading$reload_file (file_reloading.cljs?rel=1516980062278:250)
    at figwheel$client$file_reloading$blocking_load (file_reloading.cljs?rel=1516980062278:269)
    at file_reloading.cljs?rel=1516980062278:279
    at file_reloading.cljs?rel=1516980062278:277
    at figwheel$client$file_reloading$state_machine__59709__auto____1 (file_reloading.cljs?rel=1516980062278:277)
    at figwheel$client$file_reloading$state_machine__59709__auto__ (file_reloading.cljs?rel=1516980062278:277)
    at cljs$core$async$impl$ioc_helpers$run_state_machine (ioc_helpers.cljs?rel=1516980058153:35)
    at cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped (ioc_helpers.cljs?rel=1516980058153:39)
    at ioc_helpers.cljs?rel=1516980058153:48
I'm trying to get Arachne Figwheel to reload JS, but the first time the changes are pushed to the browser this error occurs, and then code reloading is broken.

jcf 2018-01-26T17:55:16.000484Z

@luke any ideas ⬆️ ? I'm using the latest versions of all Arache deps.

jcf 2018-01-26T17:55:43.000656Z

org.arachne-framework/arachne-figwheel {:mvn/version "0.2.0-master-0032-bb33280"}
org.arachne-framework/arachne-pedestal {:mvn/version "0.2.0-master-0064-fb2edbc"}
org.arachne-framework/arachne-sass {:mvn/version "0.2.0-master-0034-1769b93"}
org.arachne-framework/pedestal-assets {:mvn/version "0.2.0-master-0019-580de8f"}

jcf 2018-01-26T17:56:20.000132Z

I've also had to disable the ::webjars config because I get a spec failure with some ZIP object in place of a directory.

luke 2018-01-26T17:57:35.000566Z

@jcf hmm, I haven’t ever seen that before. Any chance you could post your config script including what your cljs compiler settings are?

jcf 2018-01-26T17:57:45.000635Z

Of course.

jcf 2018-01-26T17:58:08.000127Z

@jcf uploaded a file: https://clojurians.slack.com/files/U06FTAZV3/F8YMVAPJL/config_clj.txt

jcf 2018-01-26T17:58:42.000412Z

That's my config, including the cljs-opts I pulled out of the enterprise SPA template.

luke 2018-01-26T17:58:57.000286Z

and is this in dev or whitespace mode?

luke 2018-01-26T17:59:03.000509Z

er, sorry, dev or advanced?

jcf 2018-01-26T17:59:05.000393Z

And here's the exception from webjars not being happy:

ExceptionInfo Call to #'arachne.fileset/add did not conform to spec:
In: [1] val: #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"] fails spec: :arachne.fileset.specs/directory at: [:args :directory] predicate: (fn [f] (and (instance? java.io.File f) (.isDirectory f)))
 {:clojure.spec.alpha/problems [{:path [:args :directory], :pred (clojure.core/fn [f] (clojure.core/and (clojure.core/instance? java.io.File f) (.isDirectory f))), :val #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"], :via [:arachne.fileset.specs/directory :arachne.fileset.specs/directory], :in [1]}], :clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__2436 0x6d2bdcdc "clojure.spec.alpha$regex_spec_impl$reify__2436@6d2bdcdc"], :clojure.spec.alpha/value (#arachne.fileset.impl.TmpFileSet{:tree {}, :blob #object[java.io.File 0x47780f5c "/tmp/arachne-fs1560548959238895091"], :scratch #object[java.io.File 0x31a747 "/tmp/arachne-fs3449467318418299623"], :cache #object[java.io.File 0x6b214f83 "/tmp/arachne-fs283219324983436992"]} #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"]), :clojure.spec.alpha/args (#arachne.fileset.impl.TmpFileSet{:tree {}, :blob #object[java.io.File 0x47780f5c "/tmp/arachne-fs1560548959238895091"], :scratch #object[java.io.File 0x31a747 "/tmp/arachne-fs3449467318418299623"], :cache #object[java.io.File 0x6b214f83 "/tmp/arachne-fs283219324983436992"]} #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"]), :clojure.spec.alpha/failure :instrument, :clojure.spec.test.alpha/caller {:file "pipeline.clj", :line 135, :var-scope arachne.assets.pipeline/classpath-fileset, :local-fn fn}}
	clojure.core/ex-info (core.clj:4739)
	clojure.core/ex-info (core.clj:4739)
	clojure.spec.test.alpha/spec-checking-fn/conform!--2938 (alpha.clj:131)
	clojure.spec.test.alpha/spec-checking-fn/fn--2943 (alpha.clj:139)
	arachne.assets.pipeline/classpath-fileset/fn--32336 (pipeline.clj:135)
	clojure.core.protocols/fn--7852 (protocols.clj:168)
	clojure.core.protocols/fn--7852 (protocols.clj:124)
	clojure.core.protocols/fn--7807/G--7802--7816 (protocols.clj:19)
	clojure.core.protocols/seq-reduce (protocols.clj:31)
	clojure.core.protocols/fn--7833 (protocols.clj:75)
	clojure.core.protocols/fn--7833 (protocols.clj:75)
	clojure.core.protocols/fn--7781/G--7776--7794 (protocols.clj:13)

jcf 2018-01-26T17:59:11.000425Z

Dev.

jcf 2018-01-26T17:59:39.000236Z

I have (def dev? (constantly true)), and my cljs-opts:

(def cljs-opts {:main 'usr.client
                :optimizations (if (dev?) :none :advanced)
                :asset-path "/js/out"
                :output-to "js/app.js"
                :output-dir "js/out"
                :source-map-timestamp true})

jcf 2018-01-26T18:00:02.000517Z

So optimisations will be :none.

jcf 2018-01-26T18:00:55.000262Z

Commenting out the ::webjars input-dir and related pipeline entries circumvents the spec error with a ZipPath.

jcf 2018-01-26T18:01:35.000174Z

I'm not using any webjars so don't need that for now. I can open an issue/PR that changes the spec so zipped ditties are accepted…

luke 2018-01-26T18:02:12.000541Z

right, so that error is (fairly) straightforward, apparently a directory in a Zip is not considered a directory and therefore can’t be used in Arachne’s asset pipeline. That definitely is something that should be enhanced

luke 2018-01-26T18:02:32.000197Z

although I could have sworn I had that working…

luke 2018-01-26T18:03:02.000274Z

how private is this project? Is it the kind of thing you would be willing to clone and let me reproduce locally? I will continue to think about it but honestly with FactUI and some other client work my head has been out of the asset pipeline for a while.

jcf 2018-01-26T18:03:11.000347Z

Yeah, the Zip bit seems straightforward enough to fix if ZipPaths are supported.

jcf 2018-01-26T18:03:39.000034Z

I'll open up the repo.

jcf 2018-01-26T18:05:50.000318Z

@luke https://github.com/jcf/usr

jcf 2018-01-26T18:05:59.000228Z

Not production quality! 🙂

jcf 2018-01-26T18:07:55.000461Z

Oh, and I'm doing some gnarly stuff with deps.edn mixed with Leiningen because I want to try out something simpler (ultimately Arachne + tools.deps).

luke 2018-01-26T18:08:17.000230Z

awesome

luke 2018-01-26T18:08:32.000471Z

I need to go pick up my kid right now but I will to reproduce your problem this afternoon.

jcf 2018-01-26T18:09:05.000074Z

Cool! I'll keep an eye on Slack, and keep at trying to fix this myself.

jcf 2018-01-26T18:09:08.000288Z

Thanks, @luke!

jcf 2018-01-26T18:24:02.000390Z

May be a relevant issue: https://github.com/adzerk-oss/boot-reload/issues/121

jcf 2018-01-26T18:33:00.000324Z

@luke fixed it here: https://github.com/jcf/usr/commit/8281da793b18a95aa3bfcdb1b9a2c76f631b2576 Looks like something's been fixed in a recent release of Figwheel (I read that load was replaced with safeLoad but haven't dug deeper).

jcf 2018-01-26T18:36:02.000013Z

Upgrading Figwheel fixed the problem with jsloader.load not being around but now I get this:

jcf 2018-01-26T18:36:35.000464Z

Too many open files (I guess something to do with the fs abstraction inspired by Boot?).

jcf 2018-01-26T18:36:55.000569Z

THen clicking the error spits out this:

heads_up.cljs?rel=1516991443932:39 Uncaught TypeError: Cannot read property 'figwheelEvent' of undefined
    at heads_up.cljs?rel=1516991443932:39
    at core.cljs:4353
    at cljs.core.keep.cljs$core$IFn$_invoke$arity$2 (core.cljs:4353)
    at cljs.core.LazySeq.sval (core.cljs:3380)
    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (core.cljs:3438)
    at cljs.core.LazySeq.cljs$core$ISeq$_first$arity$1 (core.cljs:3404)
    at cljs$core$first (core.cljs:1220)
    at figwheel$client$heads_up$get_dataset (heads_up.cljs?rel=1516991443932:39)
    at HTMLDivElement.figwheel$client$heads_up$heads_up_onclick_handler (heads_up.cljs?rel=1516991443932:43)

jcf 2018-01-26T18:37:17.000493Z

If we've exhausted the number of files we're allowed to open, all bets are off. 😉

jcf 2018-01-26T18:44:33.000576Z

List of all the files opened by this Arachne-managed process:

jcf 2018-01-26T18:45:17.000545Z

I can up my ulimit etc.

jcf 2018-01-26T18:46:28.000521Z

If I change the string in my views/Layout a few times I can reliably max out the open file limit.

jcf 2018-01-26T18:46:58.000414Z

$ ulimit -Hn
4096

amarjeet 2018-01-26T19:33:55.000211Z

Is there any way to update a fact in the session?

amarjeet 2018-01-26T19:35:54.000624Z

in factui session

amarjeet 2018-01-26T19:36:12.000854Z

@luke

amarjeet 2018-01-26T19:38:15.000212Z

I have a rule that says if A is true then insert-logical B. And, at first, one event-handler inserts the fact that A is true, so B gets inserted. Now, in another event-handler, I want to either set A to false or retract A, so that B can automatically be retracted.

luke 2018-01-26T19:46:48.000013Z

@jcf ok, let me get my head around the open files issue. that came up on another project a couple months ago and we found a workaround, I’ll refresh my memory on that end get back to you.

luke 2018-01-26T19:47:14.000413Z

@amarjeet that should work already if the fact is cardinality one; it will be replaced and the logical rule effect will happen

luke 2018-01-26T19:47:28.000328Z

if it’s cardinality many then the old fact is still true as well, so nothing will be retracted

amarjeet 2018-01-26T19:48:40.000135Z

oh okay, I wasn't setting the cardinality option. I just used (f/transact-logical! [{:db/ui true}])

luke 2018-01-26T19:48:50.000409Z

yeah facts are cardinality many by default

amarjeet 2018-01-26T19:48:57.000096Z

ohho

luke 2018-01-26T19:48:58.000209Z

unless you have a schema setting them to one

amarjeet 2018-01-26T19:49:13.000245Z

got it, thats helpful. thanks much luke

luke 2018-01-26T19:50:00.000781Z

It’s possible I forgot/didn’t make a release of that for some reason

luke 2018-01-26T19:50:17.000346Z

what version of arachne-fileset is your project using? (you can check this using lein deps :tree or something like that

jcf 2018-01-26T19:51:40.000316Z

You should be able to reproduce the too many open files issue using my usr repo. If you trigger a reload by changing a cljs file a few times it pops up. I vauguely remember reloading the system via reset from the user ns contributed but can’t find an example right now.

jcf 2018-01-26T19:52:39.000542Z

I’m planning on doing some more work with Arachne and will likely open source most if not all of what I achieve. If you have a roadmap or want to collaborate on something let me know. Thanks, Luke! Catch you later.

luke 2018-01-26T19:53:09.000714Z

@jcf see my message in the main channel

luke 2018-01-26T19:53:13.000326Z

that issue was fixed I think

luke 2018-01-26T19:53:22.000206Z

but possibly not included in a release version yet

luke 2018-01-26T19:53:59.000295Z

glad you’re finding Arachne interesting, eager to see what you do with it. Let me know if there’s anything else I can do to help

💯 1
jcf 2018-01-26T19:54:32.000361Z

@luke https://github.com/jcf/usr/blob/master/deps.edn gets slurped into project.clj. I’ll copy and paste the version now…

luke 2018-01-26T19:55:13.000484Z

@jcf right: the arachne-fileset lib is a transitive dependency of the Arachne assets module

jcf 2018-01-26T19:55:15.000048Z

Oh, sorry. Didn’t see you wanted a transitive dependency.

luke 2018-01-26T19:55:19.000752Z

yeah np

luke 2018-01-26T19:55:30.000032Z

you want version 1.6.1, 1.6.0 has the “open files” bug

jcf 2018-01-26T19:55:39.000280Z

I’m AFK at the mo (it’s Friday night and 19:55 here).

luke 2018-01-26T19:55:45.000569Z

ah, k 🙂

luke 2018-01-26T19:56:02.000567Z

for now you can just manually include the newest version of org.arachne-framework/arachne-fileset

jcf 2018-01-26T19:56:08.000118Z

I’ll add an explicit dependency to my deps.edn just like Figewheel Sidecar.

luke 2018-01-26T19:56:12.000110Z

I’ll cut a release of Arachne proper upgrading the dependency soon

jcf 2018-01-26T19:56:22.000541Z

Awesome. Thanks, @luke.

luke 2018-01-26T19:56:24.000335Z

and include the sidecar version bump which it sounds like I’ll need as well

luke 2018-01-26T19:56:42.000074Z

might be a few days, I will probably port Arachne to deps.edn at the same time.

luke 2018-01-26T19:56:52.000523Z

since I now prefer that approach, since it’s out

jcf 2018-01-26T19:57:10.000307Z

Added Figwheel Sidecar in master.

luke 2018-01-26T19:57:15.000038Z

woot, thanks

luke 2018-01-26T19:57:27.000070Z

I’ll roll that into the core project

jcf 2018-01-26T19:58:00.000063Z

tools.deps is a breath of fresh air. Loving the recent output from the Cognitect guys(I guess mainly Alex??)

luke 2018-01-26T19:58:20.000261Z

Rich has the ideas, Alex does the work 😉

jcf 2018-01-26T19:59:14.000183Z

How do I ‘retweet’ a Slack comment? 🤣

luke 2018-01-26T20:08:57.000109Z

you don’t, which is why I can say such things here

🙂 2