Skip to content

feat: extract web dev utils #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/tableau.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule Tableau do
defdelegate live_reload(assigns), to: WebDevUtils.Components
end
63 changes: 0 additions & 63 deletions lib/tableau/assets.ex

This file was deleted.

50 changes: 0 additions & 50 deletions lib/tableau/code_reloader.ex

This file was deleted.

71 changes: 0 additions & 71 deletions lib/tableau/components.ex

This file was deleted.

12 changes: 0 additions & 12 deletions lib/tableau/file_system.ex

This file was deleted.

63 changes: 0 additions & 63 deletions lib/tableau/live_reload.ex

This file was deleted.

2 changes: 1 addition & 1 deletion lib/tableau/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Tableau.Router do
end

defp recompile(conn, _) do
Tableau.CodeReloader.reload()
WebDevUtils.CodeReloader.reload()
conn
end

Expand Down
6 changes: 3 additions & 3 deletions lib/tableau/server_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ defmodule Tableau.ServerSupervisor do
def init(_init_arg) do
if Application.get_env(:tableau, :server) do
children = [
Tableau.FileSystem,
WebDevUtils.FileSystem,
Tableau.Server,
Tableau.CodeReloader
WebDevUtils.CodeReloader
]

Supervisor.init(children ++ asset_children(), strategy: :one_for_one)
Expand All @@ -23,7 +23,7 @@ defmodule Tableau.ServerSupervisor do

def asset_children() do
for conf <- Application.get_env(:tableau, :assets, []) do
{Tableau.Assets, conf}
{WebDevUtils.Assets, conf}
end
end
end
4 changes: 2 additions & 2 deletions lib/tableau/websocket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Tableau.Websocket do
require Logger

def init(_args) do
:ok = Tableau.LiveReload.init(name: :tableau_file_watcher)
:ok = WebDevUtils.LiveReload.init()
{:ok, []}
end

Expand All @@ -18,7 +18,7 @@ defmodule Tableau.Websocket do
end

def handle_info({:file_event, _watcher_pid, {_path, _event}} = file_event, state) do
Tableau.LiveReload.reload!(file_event, patterns: @reloader_opts[:patterns])
WebDevUtils.LiveReload.reload!(file_event, patterns: @reloader_opts[:patterns])

{:ok, state}
end
Expand Down
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ defmodule Tableau.MixProject do
defp deps do
[
{:ex_doc, ">= 0.0.0", only: :dev},
{:file_system, "~> 0.2"},
# {:file_system, "~> 0.2"},
{:web_dev_utils, "~> 0.1"},
{:libgraph, "~> 0.16.0"},
{:bandit, "~> 1.0"},
{:websock_adapter, "~> 0.5"},
Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"thousand_island": {:hex, :thousand_island, "1.0.0", "63fc8807d8607c9d74fa670996897c8c8a1f2022c8c68d024182e45249acd756", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "996320c72ba8f34d7be9b02900622e44341649f24359e0f67643e4dda8f23995"},
"tz": {:hex, :tz, "0.26.2", "a40e4bb223344c6fc7b74dda25df1f26b88a30db23fa6e55de843bd79148ccdb", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: true]}], "hexpm", "224b0618dd1e032778a094040bc710ef9aff6e2fa8fffc2716299486f27b9e68"},
"web_dev_utils": {:hex, :web_dev_utils, "0.1.0", "0c41285667b4c9944eaa2c3189f22ec3a915c349c4b879b5ae023e8ca0824657", [:mix], [{:file_system, "~> 0.2", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "af82e1723fe76c09d817a9a9baf85160f7ed572cb4af854194d3f7609ae92f10"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
"websock_adapter": {:hex, :websock_adapter, "0.5.4", "7af8408e7ed9d56578539594d1ee7d8461e2dd5c3f57b0f2a5352d610ddde757", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "d2c238c79c52cbe223fcdae22ca0bb5007a735b9e933870e241fce66afb4f4ab"},
"yamerl": {:hex, :yamerl, "0.10.0", "4ff81fee2f1f6a46f1700c0d880b24d193ddb74bd14ef42cb0bcf46e81ef2f8e", [:rebar3], [], "hexpm", "346adb2963f1051dc837a2364e4acf6eb7d80097c0f53cbdc3046ec8ec4b4e6e"},
Expand Down