Repository: phoenixframework/phoenix
Pull request #5006 (2022-10-05 15:37:48)

Remove checks for Elixir v1.13
- ~Leverage a common fn to resolve min version~
- Update installer templates
- Update docs

Ref https://github.com/phoenixframework/phoenix/pull/4820#issuecomment-1267375088

/cc @josevalim 


Patch:
diff --git a/guides/deployment/releases.md b/guides/deployment/releases.md
index be142b42e..a492533da 100644
--- a/guides/deployment/releases.md
+++ b/guides/deployment/releases.md
@@ -170,10 +170,10 @@ If you call `mix phx.gen.release --docker` you'll see a new file with these cont
 #   - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
 #   - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20210902-slim - for the release image
 #   - https://pkgs.org/ - resource for finding needed packages
-#   - Ex: hexpm/elixir:1.12.0-erlang-24.0.1-debian-bullseye-20210902-slim
+#   - Ex: hexpm/elixir:1.14.0-erlang-24.3.4-debian-bullseye-20210902-slim
 #
-ARG ELIXIR_VERSION=1.12.0
-ARG OTP_VERSION=24.0.1
+ARG ELIXIR_VERSION=1.14.0
+ARG OTP_VERSION=24.3.4
 ARG DEBIAN_VERSION=bullseye-20210902-slim
 
 ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
diff --git a/installer/lib/mix/tasks/phx.new.ex b/installer/lib/mix/tasks/phx.new.ex
index 5e02e9018..43cb56a2a 100644
--- a/installer/lib/mix/tasks/phx.new.ex
+++ b/installer/lib/mix/tasks/phx.new.ex
@@ -338,7 +338,7 @@ defmodule Mix.Tasks.Phx.New do
 
   defp elixir_version_check! do
     unless Version.match?(System.version(), "~> 1.14") do
-      Mix.raise "Phoenix v#{@version} requires at least Elixir v1.14.\n " <>
+      Mix.raise "Phoenix v#{@version} requires at least Elixir v1.14\n " <>
                 "You have #{System.version()}. Please update accordingly"
     end
   end
diff --git a/installer/mix.exs b/installer/mix.exs
index 835610aa3..ca4252339 100644
--- a/installer/mix.exs
+++ b/installer/mix.exs
@@ -11,10 +11,11 @@ defmodule Phx.New.MixProject do
 
   # If the elixir requirement is updated, we need to update:
   #
-  #   1. the mix.exs generated by the installer
+  #   1. all mix.exs generated by the installer
   #   2. guides/introduction/installation.md
-  #   3. test/test_helper.exs at the root
-  #   4. installer/lib/phx.new.ex
+  #   3. guides/deployment/releases.md
+  #   4. test/test_helper.exs at the root
+  #   5. installer/lib/mix/tasks/phx.new.ex
   #
   @elixir_requirement "~> 1.14"
 
diff --git a/installer/templates/phx_single/formatter.exs b/installer/templates/phx_single/formatter.exs
index 373998b6c..71188d192 100644
--- a/installer/templates/phx_single/formatter.exs
+++ b/installer/templates/phx_single/formatter.exs
@@ -1,6 +1,6 @@
 [
   import_deps: [<%= if @ecto do %>:ecto, :ecto_sql, <% end %>:phoenix],<%= if @ecto do %>
-  subdirectories: ["priv/*/migrations"],<% end %><%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>
+  subdirectories: ["priv/*/migrations"],<% end %><%= if @html do %>
   plugins: [Phoenix.LiveView.HTMLFormatter],<% end %>
-  inputs: [<%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>"*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"<% else %>"*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"<% end %><%= if @ecto do %>, "priv/*/seeds.exs"<% end %>]
+  inputs: [<%= if @html do %>"*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"<% else %>"*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"<% end %><%= if @ecto do %>, "priv/*/seeds.exs"<% end %>]
 ]
diff --git a/installer/templates/phx_umbrella/apps/app_name/formatter.exs b/installer/templates/phx_umbrella/apps/app_name/formatter.exs
index cc40446b9..7c467c84e 100644
--- a/installer/templates/phx_umbrella/apps/app_name/formatter.exs
+++ b/installer/templates/phx_umbrella/apps/app_name/formatter.exs
@@ -1,6 +1,6 @@
 [<%= if @ecto do %>
   import_deps: [:ecto, :ecto_sql],
-  subdirectories: ["priv/*/migrations"],<% end %><%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>
+  subdirectories: ["priv/*/migrations"],<% end %><%= if @html do %>
   plugins: [Phoenix.LiveView.HTMLFormatter],<% end %>
-  inputs: [<%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>"*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"<% else %>"*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"<% end %><%= if @ecto do %>, "priv/*/seeds.exs"<% end %>]
+  inputs: [<%= if @html do %>"*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"<% else %>"*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"<% end %><%= if @ecto do %>, "priv/*/seeds.exs"<% end %>]
 ]
diff --git a/installer/templates/phx_umbrella/apps/app_name_web/formatter.exs b/installer/templates/phx_umbrella/apps/app_name_web/formatter.exs
index 77be8aed4..4ea75e02d 100644
--- a/installer/templates/phx_umbrella/apps/app_name_web/formatter.exs
+++ b/installer/templates/phx_umbrella/apps/app_name_web/formatter.exs
@@ -1,5 +1,5 @@
 [
-  import_deps: [:phoenix],<%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>
+  import_deps: [:phoenix],<%= if @html do %>
   plugins: [Phoenix.LiveView.HTMLFormatter],<% end %>
-  inputs: [<%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>"*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"<% else %>"*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"<% end %>]
+  inputs: [<%= if @html do %>"*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}"<% else %>"*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"<% end %>]
 ]
diff --git a/installer/templates/phx_umbrella/formatter.exs b/installer/templates/phx_umbrella/formatter.exs
index 8701bb4c2..82fc0b57c 100644
--- a/installer/templates/phx_umbrella/formatter.exs
+++ b/installer/templates/phx_umbrella/formatter.exs
@@ -1,4 +1,4 @@
-[<%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>
+[<%= if @html do %>
   plugins: [Phoenix.LiveView.HTMLFormatter],<% end %>
   inputs: ["mix.exs", "config/*.exs"],
   subdirectories: ["apps/*"]
diff --git a/installer/templates/phx_umbrella/mix.exs b/installer/templates/phx_umbrella/mix.exs
index 6233e0f33..f55dfc46d 100644
--- a/installer/templates/phx_umbrella/mix.exs
+++ b/installer/templates/phx_umbrella/mix.exs
@@ -23,7 +23,7 @@ defmodule <%= @root_app_module %>.MixProject do
   #
   # Dependencies listed here are available only for this project
   # and cannot be accessed from applications inside the apps/ folder.
-  defp deps do<%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>
+  defp deps do<%= if @html do %>
     [
       # required to run "mix format" on ~H/.heex files from the umbrella root
       <%= if @dev do %><%= @phoenix_dep_umbrella_root %>,
diff --git a/lib/phoenix/verified_routes.ex b/lib/phoenix/verified_routes.ex
index 65d2138c0..2e9c96d45 100644
--- a/lib/phoenix/verified_routes.ex
+++ b/lib/phoenix/verified_routes.ex
@@ -139,7 +139,7 @@ defmodule Phoenix.VerifiedRoutes do
     Module.put_attribute(mod, :phoenix_verified_statics, statics)
   end
 
-  @after_verify_supported Version.match?(System.version(), ">= 1.14.0-dev")
+  @after_verify_supported Version.match?(System.version(), ">= 1.14.0")
 
   defmacro __before_compile__(_env) do
     if @after_verify_supported do


Test patch:
diff --git a/installer/test/phx_new_test.exs b/installer/test/phx_new_test.exs
index e902e655c..62b5b922e 100644
--- a/installer/test/phx_new_test.exs
+++ b/installer/test/phx_new_test.exs
@@ -37,20 +37,11 @@ defmodule Mix.Tasks.Phx.NewTest do
 
       assert_file "phx_blog/README.md"
 
-      if Version.match?(System.version(), ">= 1.13.4") do
-        assert_file "phx_blog/.formatter.exs", fn file ->
-          assert file =~ "import_deps: [:ecto, :ecto_sql, :phoenix]"
-          assert file =~ "subdirectories: [\"priv/*/migrations\"]"
-          assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
-          assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\", \"priv/*/seeds.exs\"]"
-        end
-      else
-        assert_file "phx_blog/.formatter.exs", fn file ->
-          assert file =~ "import_deps: [:ecto, :ecto_sql, :phoenix]"
-          assert file =~ "subdirectories: [\"priv/*/migrations\"]"
-          assert file =~ "inputs: [\"*.{ex,exs}\", \"{config,lib,test}/**/*.{ex,exs}\", \"priv/*/seeds.exs\"]"
-          refute file =~ "plugins:"
-        end
+      assert_file "phx_blog/.formatter.exs", fn file ->
+        assert file =~ "import_deps: [:ecto, :ecto_sql, :phoenix]"
+        assert file =~ "subdirectories: [\"priv/*/migrations\"]"
+        assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
+        assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\", \"priv/*/seeds.exs\"]"
       end
 
       assert_file "phx_blog/mix.exs", fn file ->
@@ -475,13 +466,11 @@ defmodule Mix.Tasks.Phx.NewTest do
     in_tmp "new with no_ecto", fn ->
       Mix.Tasks.Phx.New.run([@app_name, "--no-ecto"])
 
-      if Version.match?(System.version(), ">= 1.13.4") do
-        assert_file "phx_blog/.formatter.exs", fn file ->
-          assert file =~ "import_deps: [:phoenix]"
-          assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
-          assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\"]"
-          refute file =~ "subdirectories:"
-        end
+      assert_file "phx_blog/.formatter.exs", fn file ->
+        assert file =~ "import_deps: [:phoenix]"
+        assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
+        assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\"]"
+        refute file =~ "subdirectories:"
       end
     end
   end
diff --git a/installer/test/phx_new_umbrella_test.exs b/installer/test/phx_new_umbrella_test.exs
index 7a9769cec..7421bd1f3 100644
--- a/installer/test/phx_new_umbrella_test.exs
+++ b/installer/test/phx_new_umbrella_test.exs
@@ -46,14 +46,8 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
       end
 
       # Phoenix.LiveView.HTMLFormatter
-      if Version.match?(System.version(), ">= 1.13.4") do
-        assert_file root_path(@app, "mix.exs"), fn file ->
-          assert file =~ "{:phoenix_live_view, \">= 0.0.0\"}"
-        end
-      else
-        assert_file root_path(@app, "mix.exs"), fn file ->
-          assert file =~ "defp deps do\n    []"
-        end
+      assert_file root_path(@app, "mix.exs"), fn file ->
+        assert file =~ "{:phoenix_live_view, \">= 0.0.0\"}"
       end
 
       assert_file app_path(@app, "mix.exs"), fn file ->
@@ -87,48 +81,25 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
 
       assert_file root_path(@app, "config/runtime.exs"), ~r/ip: {0, 0, 0, 0, 0, 0, 0, 0}/
 
-      if Version.match?(System.version(), ">= 1.13.4") do
-        assert_file root_path(@app, ".formatter.exs"), fn file ->
-          assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
-          assert file =~ "inputs: [\"mix.exs\", \"config/*.exs\"]"
-          assert file =~ "subdirectories: [\"apps/*\"]"
-        end
-
-        assert_file app_path(@app, ".formatter.exs"), fn file ->
-          assert file =~ "import_deps: [:ecto, :ecto_sql]"
-          assert file =~ "subdirectories: [\"priv/*/migrations\"]"
-          assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
-          assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\", \"priv/*/seeds.exs\"]"
-        end
-
-        assert_file web_path(@app, ".formatter.exs"), fn file ->
-          assert file =~ "import_deps: [:phoenix]"
-          assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
-          assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\"]"
-          refute file =~ "import_deps: [:ecto]"
-          refute file =~ "subdirectories:"
-        end
-      else
-        assert_file root_path(@app, ".formatter.exs"), fn file ->
-          assert file =~ "inputs: [\"mix.exs\", \"config/*.exs\"]"
-          assert file =~ "subdirectories: [\"apps/*\"]"
-          refute file =~ "plugins:"
-        end
+      assert_file root_path(@app, ".formatter.exs"), fn file ->
+        assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
+        assert file =~ "inputs: [\"mix.exs\", \"config/*.exs\"]"
+        assert file =~ "subdirectories: [\"apps/*\"]"
+      end
 
-        assert_file app_path(@app, ".formatter.exs"), fn file ->
-          assert file =~ "import_deps: [:ecto]"
-          assert file =~ "subdirectories: [\"priv/*/migrations\"]"
-          assert file =~ "inputs: [\"*.{ex,exs}\", \"{config,lib,test}/**/*.{ex,exs}\", \"priv/*/seeds.exs\"]"
-          refute file =~ "plugins:"
-        end
+      assert_file app_path(@app, ".formatter.exs"), fn file ->
+        assert file =~ "import_deps: [:ecto, :ecto_sql]"
+        assert file =~ "subdirectories: [\"priv/*/migrations\"]"
+        assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
+        assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\", \"priv/*/seeds.exs\"]"
+      end
 
-        assert_file web_path(@app, ".formatter.exs"), fn file ->
-          assert file =~ "import_deps: [:phoenix]"
-          assert file =~ "inputs: [\"*.{ex,exs}\", \"{config,lib,test}/**/*.{ex,exs}\"]"
-          refute file =~ "import_deps: [:ecto]"
-          refute file =~ "subdirectories:"
-          refute file =~ "plugins:"
-        end
+      assert_file web_path(@app, ".formatter.exs"), fn file ->
+        assert file =~ "import_deps: [:phoenix]"
+        assert file =~ "plugins: [Phoenix.LiveView.HTMLFormatter]"
+        assert file =~ "inputs: [\"*.{heex,ex,exs}\", \"{config,lib,test}/**/*.{heex,ex,exs}\"]"
+        refute file =~ "import_deps: [:ecto]"
+        refute file =~ "subdirectories:"
       end
 
       assert_file app_path(@app, "lib/#{@app}/application.ex"), ~r/defmodule PhxUmb.Application do/