Skip to content

Commit

Permalink
Add HTMLFormatter to umbrella root (#4800)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Apr 19, 2022
1 parent 510061e commit 16021a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion installer/templates/phx_umbrella/formatter.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
[<%= if @html and Version.match?(System.version(), ">= 1.13.4") do %>
plugins: [Phoenix.LiveView.HTMLFormatter],<% end %>
inputs: ["mix.exs", "config/*.exs"],
subdirectories: ["apps/*"]
]
12 changes: 12 additions & 0 deletions installer/test/phx_new_umbrella_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ 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]"
assert file =~ "subdirectories: [\"priv/*/migrations\"]"
Expand All @@ -103,6 +109,12 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
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 app_path(@app, ".formatter.exs"), fn file ->
assert file =~ "import_deps: [:ecto]"
assert file =~ "subdirectories: [\"priv/*/migrations\"]"
Expand Down

0 comments on commit 16021a6

Please sign in to comment.