Major upgrade of Chestnut coming


#1

I’ve been tinkering over the holidays to bring Chestnut up to date with the current state of the art in Clojurescript/Clojure/Figwheel. It’s currently on Github master, I’ll probably push it out as 0.9.0-SNAPSHOT soon-ish so people can easily give it a try.

One nice thing is it contains a lot less boilerplate. It uses figwheel-sidecar.repl-api under the hood now, which means we no longer need to duplicate the figwheel setup, it’s read straight from project.clj. Clojurescript is now easier to use with {:optimizations :none}, so we no longer have to manually inject a goog.require.

Weasel was dropped in favor of fighwheel repl, you can use it the “lein figwheel” way, or from an nrepl the chestnut way with (run) and (browser-repl).

I’m still testing and tweaking but any feedback is very welcome.


#2

I have a bunch of changes that I still need to push, so maybe hold of with testing another day. I’ll push them by tonight (CET).


#3

Can’t wait for this to become stable! It looks pretty jucy.

EDIT: I probably am dumb and just need java 8. Thanks sounding board!

Edit again, that didn’t do it, but it was a good thought. lein repl fails with not being able to find clojure.java.shell. hrumph.

edit: flags seem to produce some interesting and cryptic behavior in the new snapshot

this works: lein new chestnut hello --snapshot
this does not: lein new chestnut hello --snapshot -- --less --http-kit

What’s the plan with flags in the next version?

I’m testing a barebones project via emacs + cider… not sure if this is from figwheel, cider, or chestnut, but I seem to be getting some interesting stack traces:

error in process sentinel: Could not start nREPL server: Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.main.<clinit>(main.java:20) Caused by: java.lang.ClassNotFoundException: clojure.java.shell, compiling:(user.clj:10:5) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6730) at clojure.lang.Compiler.analyze(Compiler.java:6524) at clojure.lang.Compiler.analyze(Compiler.java:6485) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721) at clojure.lang.Compiler.analyze(Compiler.java:6524) at clojure.lang.Compiler.analyze(Compiler.java:6485) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3791) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6725) at clojure.lang.Compiler.analyze(Compiler.java:6524) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711) at clojure.lang.Compiler.analyze(Compiler.java:6524) at clojure.lang.Compiler.analyze(Compiler.java:6485) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5861) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5296) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3925) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6721) at clojure.lang.Compiler.analyze(Compiler.java:6524) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6711) at clojure.lang.Compiler.analyze(Compiler.java:6524) at clojure.lang.Compiler.access$300(Compiler.java:38) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:577) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6723) at clojure.lang.Compiler.analyze(Compiler.java:6524) at clojure.lang.Compiler.analyze(Compiler.java:6485) at clojure.lang.Compiler.eval(Compiler.java:6786) at clojure.lang.Compiler.load(Compiler.java:7227) at clojure.lang.RT.loadResourceScript(RT.java:371) at clojure.lang.RT.loadResourceScript(RT.java:358) at clojure.lang.RT.maybeLoadResourceScript(RT.java:354) at clojure.lang.RT.doInit(RT.java:468) at clojure.lang.RT.<clinit>(RT.java:330) ... 1 more Caused by: java.lang.ClassNotFoundException: clojure.java.shell at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at clojure.lang.DynamicClassLoader.loadClass(DynamicClassLoader.java:77) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:274) at clojure.lang.RT.classForName(RT.java:2154) at clojure.lang.RT.classForName(RT.java:2163) at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:1017) at clojure.lang.Compiler$HostExpr.access$600(Compiler.java:795) at clojure.lang.Compiler.macroexpand1(Compiler.java:6662) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6709) ... 34 more Subprocess failed

on Leiningen 2.5.3 on Java 1.7.0_79 OpenJDK 64-Bit Server VM,
GNU Emacs 24.5.1

profiles.clj:

{:user
  {
   :dependencies [[org.clojure/tools.nrepl "0.2.11"]]
   :plugins [[cider/cider-nrepl "0.10.0"]]}}

#4

Thanks, that’s useful input. If it only works on Java 8 we’ll have to
document that. I’ll see if I can reproduce that error on 1.7.


#5

Yeah, Figwheel seems to want java8

As for my issue, I don’t think it was above, but I’m certain that documenting the target for java >=8 couldn’t hurt.

I’m on java 8 now, and I can still reproduce it, but only by using the flags above:
lein new chestnut _name_ --snapshot -- --less --http-kit
Probably some issue with the templates?

Without flags, I’m able to generate a project and start a repl just fine.

However, while I’m able to get a server up now – (run) brings everything up just fine – (browser-repl) seems to freeze for me, and figwheel is stuck waiting at:
Prompt will show when Figwheel connects to your application

localhost:3449 shows the application (no hot reloading, but manual refreshes show changes).
localhost:10555 doesn’t appear to be connected.

Derp again. Just saw your note about reloading not working currently in your .9 PR here https://github.com/plexus/chestnut/pull/160 Sorry about that. Everything looks good sofar


#6

but only by using the flags above:
lein new chestnut name --snapshot – --less --http-kit
Probably some issue with the templates?

That’s entirely possible, I have only tested the vanilla version so far.

localhost:3449 shows the application (no hot reloading, but manual refreshes show changes).
localhost:10555 doesn’t appear to be connected.

localhost:10555 is gone, when using Figwheel you should only use 3449, figwheel will serve the API/backend (if any) as well.

Automatic code reloading should work by now though. In any case thanks for the input, this will still require some polishing before it can go out the door.


#7

This just dawned on me, but is there a suggested or required something in your profile that would differ?

In any case, thanks so much for all of your hard work on this project, it’s excellent, and was such a great introduction to the world of clojure/clojurescript!


#8

Turns out the template was missing a cljs figwheel flag by default. PR thrown at you!

edit: less/sass fixed, too.

Hope this helps :wink:


#9

I think we’re almost there. I’m going to demo the new version at clojure Berlin on Wednesday, so I’m hoping to have it out the door by then.

I added a couple more niceties like http request/response logging, and enabling of reflection warnings.

I’ve also added a (GET "/" ..) to serve index.html, this way accessing the root works out of the box like before, and this way it’s more obvious where and how to add more routes.


#10

Aside from the figwheel logging bug, what else is outstanding? om.next/reagent flags, right?


#11

Actually it’s just updating the docs, writing an announcement message for
the Clojure mailing list, and maybe an extra round of testing.
Om.next/reagent can wait till the next version.


#12