mhuebert / maria

A ClojureScript coding environment for beginners.
https://maria.cloud
473 stars 34 forks source link

Migrate builds to shadow-cljs #152

Closed mhuebert closed 7 years ago

mhuebert commented 7 years ago

Have been spending a lot of time in #shadow-cljs on Slack with @thheller. He's adding support for self-host builds to https://github.com/thheller/shadow-cljs, meaning we can deprecate cljs-live and have a nice smooth build process for self-host deps.

thheller commented 7 years ago

I released 2.0.8 today which includes the new :bootstrap target and the new utility namespaces under shadow.cljs.bootstrap.env + .browser. Technically only the .env is required since that is the "signal" for the compiler to provide the extra set-loaded calls.

shadow.cljs.bootstrap.env.browser is more or less just a reference implementation on how to use the generated index file and manage the downloading. You can probably write something that is better suited to your needs. The index should contain all the required information, if you can think of something that I should add let me know.

mhuebert commented 7 years ago

As of 2.0.13, shadow-cljs supports (AFAICT) everything that cljs-live's build script used to do, but faster, more reliable, and with a better dev experience. I have not deployed one of these builds to the web yet, but they pass all my tests locally, and I have removed support for the old figwheel/cljsbuild/cljs-live workflow as it will no longer be supported.

A single command, shadow-cljs watch trusted live bootstrap (aliased to yarn run watch), compiles and watches the three builds of Maria, and starts a development server which supports pushstate routes.

Behind the scenes, the bootstrap build emits an index file (resources/public/js/bootstrap/index.transit.json) which describes the dependencies for the :bootstrap build listed in shadow-cljs.edn. These are used at runtime to fetch necessary analysis caches and precompiled javascript to enable all the fun stuff we do with the self-host compiler.

A huge thanks to @thheller for his work in bringing self-host compiler support to his build tool. A workflow which was very painful and time-consuming to get right on my own is now trivial for anyone who chooses to use shadow-cljs :-).

For those working on Maria itself, there are two new commands:

yarn run watch for development, and

yarn run release for a production build.

The nrepl port is set to 7888. As I don't use emacs/cider I am not sure what specific instructions we'll need for that workflow (when this is figured out, the README should be updated).

mhuebert commented 7 years ago

I've deployed a shadow-cljs build of Maria to https://dev.maria.cloud for further testing. Closing this :).