Upgrading Backpex
You are an expert at upgrading Backpex versions. When the user wants to upgrade, follow this process:
- Determine current and target versions from
mix.exs - Read the relevant upgrade guides for each version in between
- Apply changes systematically, one breaking change at a time
- Verify the project compiles and tests pass after each change
Finding the Current Version
Check mix.exs for the Backpex dependency:
{:backpex, "~> 0.19.0"}
Upgrade Guides Location
All upgrade guides are at guides/upgrading/ in the Backpex repository (also available on HexDocs). Read these files directly to get the exact migration steps:
| Version | File |
|---|---|
| 0.18 | guides/upgrading/v0.18.md |
| 0.17 | guides/upgrading/v0.17.md |
| 0.16 | guides/upgrading/v0.16.md |
| 0.15 | guides/upgrading/v0.15.md |
| 0.14 | guides/upgrading/v0.14.md |
| 0.13 | guides/upgrading/v0.13.md |
| 0.12 | guides/upgrading/v0.12.md |
| 0.11 | guides/upgrading/v0.11.md |
| 0.10 | guides/upgrading/v0.10.md |
| 0.9 | guides/upgrading/v0.9.md |
| 0.8 | guides/upgrading/v0.8.md |
| 0.7 | guides/upgrading/v0.7.md |
| 0.6 | guides/upgrading/v0.6.md |
| 0.5 | guides/upgrading/v0.5.md |
| 0.3 | guides/upgrading/v0.3.md |
| 0.2 | guides/upgrading/v0.2.md |
Upgrade Process
Read ALL upgrade guides between current and target version. For example, upgrading from 0.15 to 0.19 requires reading v0.16, v0.17, v0.18, and v0.19 guides.
Bump the dependency in
mix.exs:{:backpex, "~> 0.19.0"}Run
mix deps.getto fetch the new version.Apply breaking changes from each guide in order. Common categories:
- Removed or renamed options
- New required callbacks
- Changed callback signatures
- Moved or renamed components
- Removed dependencies
- New Gettext translation strings
Compile and fix warnings:
mix compile --warnings-as-errorsRun tests to catch regressions.
Common Breaking Change Patterns
Callback replaces option
# Before (option)
use Backpex.LiveResource, layout: {MyAppWeb.Layouts, :admin}
# After (callback)
use Backpex.LiveResource, ...
@impl Backpex.LiveResource
def layout(_assigns), do: {MyAppWeb.Layouts, :admin}
New required callback added
Read the upgrade guide for the default value and implement it in affected modules.
Changed callback signature
Search your codebase for the old callback name and update all implementations.
Removed dependency
Check if your code directly uses the removed module/function and replace with the suggested alternative.
New Gettext strings
Each Backpex release may add new translatable strings. After upgrading:
Copy the updated Gettext template from the Backpex dependency into your application:
cp deps/backpex/priv/gettext/backpex.pot priv/gettext/backpex.potAlternatively, download it from GitHub at
https://github.com/naymspace/backpex/blob/<VERSION>/priv/gettext/backpex.pot(replace<VERSION>with your target version tag).Remove
elixir-autogencomments from the copied.potfile. The Backpex source file contains#, elixir-autogen, elixir-formatcomment lines. If left in place, runningmix gettext.extract --mergewill delete all Backpex translations from your PO files (Gettext treats autogen entries as auto-generated and removes those not found in your source code). Strip them:sed -i '' 's/#, elixir-autogen, elixir-format/#, elixir-format/g' priv/gettext/backpex.potMerge the new strings into your existing PO files:
mix gettext.merge priv/gettextTranslate any new
msgidentries in yourpriv/gettext/<locale>/LC_MESSAGES/backpex.pofiles.
The .pot file on the develop branch may contain unreleased translations. Always use the version tag that matches your Backpex version.