Skip to content

Commit

Permalink
[gh315] Update - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
andyduong1920 committed Mar 10, 2023
1 parent ec3d4b8 commit 8285a95
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 115 deletions.
26 changes: 0 additions & 26 deletions lib/nimble_template/addons/variants/phoenix/web/es_lint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@ defmodule NimbleTemplate.Addons.Phoenix.Web.EsLint do
|> copy_files!()
end

def edit_app_js!(%Project{live_project?: true} = project) do
update_topbar_js_variables!()

project
end

def edit_app_js!(%Project{web_project?: true} = project) do
update_topbar_js_variables!()

project
end

def edit_app_js!(project), do: project

defp edit_files!(%Project{} = project) do
Expand Down Expand Up @@ -91,18 +79,4 @@ defmodule NimbleTemplate.Addons.Phoenix.Web.EsLint do

project
end

defp update_topbar_js_variables! do
Generator.replace_content!(
"assets/js/app.js",
"window.addEventListener(\"phx:page-loading-start\", info => topbar.show())",
"window.addEventListener(\"phx:page-loading-start\", _info => topbar.show())"
)

Generator.replace_content!(
"assets/js/app.js",
"window.addEventListener(\"phx:page-loading-stop\", info => topbar.hide())",
"window.addEventListener(\"phx:page-loading-stop\", _info => topbar.hide())"
)
end
end
29 changes: 0 additions & 29 deletions lib/nimble_template/addons/variants/phoenix/web/heex_formatter.ex

This file was deleted.

10 changes: 5 additions & 5 deletions lib/nimble_template/addons/variants/phoenix/web/svg_sprite.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ defmodule NimbleTemplate.Addons.Phoenix.Web.SvgSprite do
Generator.replace_content!(
"#{web_path}.ex",
"""
# Include shared imports and aliases for views
unquote(view_helpers())
# HTML escaping functionality
import Phoenix.HTML
""",
"""
import #{web_module}.IconHelper
# HTML escaping functionality
import Phoenix.HTML
# Include shared imports and aliases for views
unquote(view_helpers())
import #{web_module}.IconHelper
"""
)

Expand Down
3 changes: 1 addition & 2 deletions lib/nimble_template/helpers/credo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ defmodule NimbleTemplate.CredoHelper do
[
"#{base_path}/release_tasks.ex",
"#{web_path}/controllers/page_controller.ex",
"#{web_path}/telemetry.ex",
"#{web_path}/views/error_view.ex"
"#{web_path}/telemetry.ex"
]
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ defmodule NimbleTemplate.Templates.Phoenix.Web.Template do
|> Web.StyleLint.apply!()
|> Web.EsBuild.apply!()
|> Web.PostCSS.apply!()
|> Web.HeexFormatter.apply!()
end

defp apply_optional_web_addons(%Project{optional_addons: optional_addons} = project) do
Expand Down
22 changes: 0 additions & 22 deletions test/nimble_template/addons/variants/phoenix/web/es_lint_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,4 @@ defmodule NimbleTemplate.Addons.Phoenix.Web.EsLintTest do
end)
end
end

describe "#apply!/2 to a Live project" do
@describetag live_project?: true
@describetag required_addons: [:TestEnv, :"Phoenix.Web.NodePackage"]

test "updates the assets/js/app.js", %{
project: project,
test_project_path: test_project_path
} do
in_test_project!(test_project_path, fn ->
WebAddons.EsLint.apply!(project)

assert_file("assets/js/app.js", fn file ->
assert file =~
"window.addEventListener(\"phx:page-loading-start\", _info => topbar.show())"

assert file =~
"window.addEventListener(\"phx:page-loading-stop\", _info => topbar.hide())"
end)
end)
end
end
end

This file was deleted.

6 changes: 0 additions & 6 deletions test/nimble_template/helpers/credo_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ defmodule NimbleTemplate.CredoHelperTest do
# credo:disable-for-this-file CompassCredoPlugin.Check.DoSingleExpression
"""
end)

assert_file("#{test_project_path}/lib/nimble_template_web/views/error_view.ex", fn file ->
assert file =~ """
# credo:disable-for-this-file CompassCredoPlugin.Check.DoSingleExpression
"""
end)
end)
end
end
Expand Down

0 comments on commit 8285a95

Please sign in to comment.