Example of upgrade a Phoenix application from 1.6 to 1.7

Hey, I’m comparatively new to this forum, so I would appreciate any feedback if I had to choose another category or do something else with the post.

Anyway, I wanted to share an example of a pull request where I’ve successfully upgraded Phoenix in quite a little application I’m working on from time to time.

It was successfully upgraded from Phoenix 1.6.11 to 1.7.2 (including all the dependencies), and I hope that it will be useful for some folks who are looking for similar information.

Here is the link to the PR: Upgrade to Phoenix 1.7 plus other dependencies by cr0t · Pull Request #29 · cr0t/lexin · GitHub

There are a couple of main sources of information on what to be upgraded that was used:

Key points:

  • layouts, templates, and views are shuffled around; this also leads to a bit more straightforward directories hierarchy
  • partials are rendered with the new syntax:
    - <%= render("_service_worker_loader.html") %>
    + <._service_worker_loader` />
  • we get free HTML formatting out-of-box for all *.heex files; though it does not the perfect job to *.js.heex files
  • static routes and ~p sigil saves horizontal and vertical space
  • we need to support CoreComponents module which is by default Tailwinded (it contains Tailwind classes everywhere); it was not such a big deal for our little app

Heex is a template engine for html specifically. I think for other formats you’d want to stick to .eex.

1 Like

Thank you! You’re totally right. I missed such an obvious thing, shame on me! :slight_smile: