Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

V0.9 #160

Merged
merged 35 commits into from
Jan 29, 2016
Merged

V0.9 #160

merged 35 commits into from
Jan 29, 2016

Conversation

plexus
Copy link
Owner

@plexus plexus commented Dec 22, 2015

This is the first big update in a while, and should bring Chestnut bing on par with current state of the art.

Now that Figwheel is more full featured we can drastically simplify things.

Drop Weasel and instead use the setup described here: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl

The cool thing is we can still have the same public facing API : lein repl / (run) / (browser-repl).

  • No more Weasel, just nREPL + Figwheel-sidecar
  • No longer two web servers in dev mode, just figwheel on 3449 with our http handler
  • Drop the double figwheel config, figwheel-sidecar.repl-api will pull it out of project.clj
  • Rename dev to server-impl, I think this makes more sense

In project.clj instead of having lots of stuff inside the :dev profile, move
more of it to the top level, and just override what needs overriding in the
:uberjar profile. This also helps with figwheel's repl-api, because that one
reads project.clj but without profile merging.

TODOS

  • see if the figwheel bug below is already reported
  • explicitly ask to add a code of conduct instead of adding it blindly
  • replace the cljs testing boilerplate stuff with doo

@plexus
Copy link
Owner Author

plexus commented Jan 4, 2016

This is already looking a pretty decent. I'm gonna push this out soon as 0.9.0-SNAPSHOT so folks can try it out. I think this will be mostly the scope for 0.9.

@plexus
Copy link
Owner Author

plexus commented Jan 9, 2016

I've started a new app with this version of Chestnut to get a better feel for it. Some things I've noticed

  • Chestnut now creates an initial Git commit, but the git library outputs some warnings about logging, which isn't cool
  • I added ring/json since I want to use a JSON API. It works, but the content type of the response is text/html instead of application/json. Probably some middleware is setting the content type before the json middleware gets to it.

@plexus
Copy link
Owner Author

plexus commented Jan 9, 2016

Doing a heroku create / git push heroku still works out of the box, so that's great. But, you have to acess /index.html explicitly, if you access the root jetty complains. This may be only an issue with jetty, not with http-kit. In that case we might as well drop jetty and just use http-kit by default.

plexus and others added 23 commits January 11, 2016 22:23
Now that Figwheel is more full featured we can drastically simplify things.

- No more Weasel, just nREPL + Figwheel-sidecar
- No longer two web servers in dev mode, just figwheel on 3449 with our http handler
- Drop the double figwheel config, figwheel-sidecar.repl-api will pull it out of project.clj
- Rename dev to server-impl, I think this makes more sense

In project.clj instead of having lots of stuff inside the :dev profile, move
more of it to the top level, and just override what needs overriding in the
:uberjar profile. This also helps with figwheel's repl-api, because that one
reads project.clj but without profile merging.
index.html no longer needs pre-processing in dev mode, we can serve it
up statically, so it can go straight into public/.
Various tweaks and cleanup in project.clj, including bringing the
cljsbuild and figwheel config up to current standard.
Before we had development helper functions like (run) and (browser-repl)
inside the {{project-ns}}.server namespace, and we would start the repl
with that as the default namespace, so they were available.

In prod mode we don't want to include figwheel though, and there are
potentially other small differences, so we had a separate source
directory for dev and prod, so you could implement a namespace twice,
once for each env.

The newer setup is simpler, we add our convenience functions to `user`,
and start the repl in `user` the way it does by default. The good thing
about this is you have the default clojure repl functions like doc and
source available as well. This dramatically simplifies the directory layout.
In a production setup you would more typically let your static assets be
served up by a separate server like nginx, and let that one handle
caching headers.
Adding clojure.java.shell in :require for sass and less
This prevents warnings when using clj-jgit.
@plexus
Copy link
Owner Author

plexus commented Jan 11, 2016

I think I've addressed the main issues. I would like to push this out as a new release this week.

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.

@plexus
Copy link
Owner Author

plexus commented Jan 11, 2016

One thing I noticed which seems to be a figwheel bug: when you configure a server log path for figwheel, it only uses it for the cljs stuff, CSS reloading still causes it to log to the default location.

For CLJS testing we switch to doo, this allows us to drop a lot of
boilerplate. Get rid of the --speclj option, let's do one thing and do
it well.
Introducing this extra level of indirections means that when the server
implementation (e.g. the routes) changes, and ring.reload reloads it,
figwheel actually uses the new definition.
plexus added a commit that referenced this pull request Jan 29, 2016
@plexus plexus merged commit d924bed into master Jan 29, 2016
@plexus
Copy link
Owner Author

plexus commented Jan 29, 2016

ship

shipping it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants