Skip to content

Commit

Permalink
Remove old generator
Browse files Browse the repository at this point in the history
  • Loading branch information
bcardarella committed Jul 27, 2024
1 parent 10ac88e commit 0b35c7b
Showing 1 changed file with 0 additions and 84 deletions.
84 changes: 0 additions & 84 deletions lib/mix/tasks/lvn.setup.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule Mix.Tasks.Lvn.Setup do
use Mix.Task

alias Mix.Tasks.Phx.Gen
alias Mix.LiveViewNative.{CodeGen, Context}
alias Sourceror.Zipper

Expand Down Expand Up @@ -103,89 +102,6 @@ defmodule Mix.Tasks.Lvn.Setup do
|> Enum.reduce(context, &(&1.(&2)))
end

def gen(context) do
plugins = []

plugins? = length(plugins) > 0

apps = Mix.Project.deps_apps()

stylesheet_opt? = Keyword.get(context.opts, :stylesheet, true)
stylesheet_app? = Enum.member?(apps, :live_view_native_stylesheet)
stylesheet? = stylesheet_opt? && stylesheet_app?

live_form_opt? = Keyword.get(context.opts, :live_form, true)
live_form_app? = Enum.member?(apps, :live_view_native_live_form)

if !plugins? do
Mix.shell().info("""
You have no client plugins configured. `mix lvn.setup` requires
at least one LiveView Native client plugin configured. Add one LVN client
as a dependency then configure it. For example, if you have both `live_view_native_swiftui`
and `live_view_native_jetpack` added as dependencies you would add the following:
\e[93;1m# config/config.exs\e[0m
\e[32;1mconfig :live_view_native, plugins: [
LiveViewNative.Jetpack,
LiveViewNative.SwiftUI
]\e[0m
""")
end

if stylesheet_opt? && !stylesheet_app? do
Mix.shell().info("""
`live_view_native_styelsheet` is not included as a dependency. Please add it and re-run
this setup task. If you do not wish to use `live_view_native_stylesheet` run this task as
`mix lvn.setup --no-stylesheet`
""")
end

if live_form_opt? && !live_form_app? do
Mix.shell().info("""
`live_view_native_live_form` is not included as a dependency. Please add it and re-run
this setup task. If you do not wish to generate `live_form` components run this task
as `mix lvn.setup --no-live-form`
""")
end

if plugins? &&
((stylesheet_opt? && stylesheet_app?) || !stylesheet_opt?) &&
((live_form_opt? && live_form_app?) || !live_form_opt?) do
Mix.Task.run("lvn.gen", ["--no-info"])

Enum.each(plugins, fn(plugin) ->
format = Atom.to_string(plugin.format)

args = if !live_form_opt? do
["--no-live-form"]
else
[]
end

format_task_gen_module = Module.concat([Mix.Tasks.Lvn, Macro.camelize(format), Gen])

if Mix.Task.task?(format_task_gen_module) do
Mix.Task.run("lvn.#{format}.gen", args)
end

Mix.Task.run("lvn.gen.layout", [format])

if stylesheet? do
Mix.Task.run("lvn.stylesheet.gen", [format, "App", "--no-info"])
end
end)

Mix.Task.rerun("lvn.gen", ["--no-copy"])

if stylesheet? do
Mix.Task.rerun("lvn.stylesheet.gen", ["--no-copy"])
end
end


end

@doc false
def build_file_map(file_map) do
Enum.into(file_map, %{}, fn({key, path}) ->
Expand Down

0 comments on commit 0b35c7b

Please sign in to comment.