richeterre / jumubase

A friendly monolith for managing "Jugend musiziert" contests ♫
MIT License
3 stars 0 forks source link

Upgrade to Phoenix 1.4 #5

Closed richeterre closed 5 years ago

richeterre commented 5 years ago

This follows the official Phoenix 1.4 upgrade guide.

Steps to complete:

richeterre commented 5 years ago

Some thoughts about the last two steps in the list:

Upgrading Poison to Jason is straightforward on the Phoenix side, but tricky when it comes to our custom ecto_encoders.ex. We need to provide an encode/2 for ranges (easy) since Jason doesn't have a built-in one, but even then there are some strange compiler errors. We should also rethink whether we really want to encode the full changeset (which may contain sensitive data such as participant results) or clean it up first. The latter would also remove the need for custom encoding of __meta__ fields and Ecto.Association.NotLoaded values, finally getting rid of the "redefining module" compiler warnings.

As for the Webpack upgrade, I took a stab at it but didn't get the Bootstrap 3 integration to work. Looking at the Brunch config, we need to ensure that

What I tried so far was following the upgrade guide and adding a sass-loader.

@denisw, let me know if you can help me with either of the two points above 🙂

denisw commented 5 years ago

A mapping function that explicitly maps the changeset to a encodable map sounds like a very good idea. Then we could remove ecto_encoders altogether.

I can try my hand at the Webpack migration!

richeterre commented 5 years ago

Awesome! Out of curiosity, why don't we need UglifyJsPlugin or OptimizeCSSAssetsPlugin as specified in the migration guide? Is minifying somehow already included "in the box" or would we just be overoptimizing things?

denisw commented 5 years ago

UglifyJSPlugin is enabled automatically by --mode production.

https://webpack.js.org/concepts/mode/

I guess we could add OptimizeCSSAssetsPlugin - not sure how much of a difference it makes, but why not.

richeterre commented 5 years ago

I think we can skip the CSS optimizing, as it adds another dependency for what is probably a minuscule gain.

So I took a stab at the Poison -> Jason migration, but I'm not quite happy with it yet. Will add some inline comments, perhaps there are better solutions…

richeterre commented 5 years ago

I'll merge this in to get the Webpack transition into master to be able to work on JS stuff, and keep the Poison-to-Jason migration [WIP] in a separate branch.