Closed richeterre closed 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
node_modules/bootstrap-sass/assets/stylesheets
is compiled (Sass) with precision: 8
node_modules/bootstrap-sass/assets/fonts/bootstrap
gets copied to the fonts
directoryjQuery
, $
and bootstrap
JS is made available globallyWhat 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 🙂
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!
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?
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.
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…
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.
This follows the official Phoenix 1.4 upgrade guide.
Steps to complete: