defmodule Aurora.MixProject do use Mix.Project def project do [ app: :aurora, version: "2.0.0", elixir: "~> 1.18.4-otp-28", start_permanent: Mix.env() == :prod, deps: deps(), aliases: aliases(), preferred_cli_env: [bench: :dev], dialyzer: [ignore_warnings: ".dialyzer_ignore.exs"], description: description(), package: package(), source_url: "https://github.com/lorenzo-sf/aurora", homepage_url: "https://hex.pm/packages/aurora", docs: [ main: "readme", extras: ["README.md", "CHANGELOG.md", "LICENSE"], source_ref: "v2.0.0", source_url: "https://github.com/lorenzo-sf/aurora" ], escript: [main_module: Aurora.CLI] ] end def application do [ extra_applications: [:logger] ] end defp aliases do [ gen: [ "escript.build", "deploy", "tools_version" ], deploy: fn _ -> dest_dir = Path.expand("~/.Ypsilon") File.mkdir_p!(dest_dir) File.cp!("aurora", Path.join(dest_dir, "aurora")) IO.puts("✅ Escript instalado en #{dest_dir}/aurora") end, tools_version: fn _ -> dest_dir = Path.expand("~/.Ypsilon") tool_versions_path = Path.join(dest_dir, ".tool-versions") File.write!(tool_versions_path, """ erlang 28.1 elixir 1.18.4-otp-28 """) IO.puts("✅ Archivo .tool-versions creado en #{tool_versions_path}") end, quality: [ fn _ -> case Mix.shell().cmd("mix format --check-formatted", quiet: true) do 0 -> :ok _ -> Mix.shell().info("⚠️ mix format detectó cambios necesarios") Mix.shell().cmd("mix format") end end, fn _ -> Mix.Task.run("deps.get", []) end, fn _ -> case Mix.shell().cmd("mix credo --strict --format=oneline", quiet: true) do 0 -> Mix.shell().info("✅ CREDO terminado") 0 code -> Mix.shell().error("❌ CREDO falló con código #{code}") # Re-ejecutar para mostrar los errores Mix.shell().cmd("mix credo --strict --format=oneline", quiet: false) code end end, fn _ -> case Mix.Task.run("compile", ["--warnings-as-errors"]) do :ok -> Mix.shell().info("✅ COMPILE terminado") {:ok, _} -> Mix.shell().info("✅ COMPILE terminado") {:error, _} = error -> Mix.shell().error("❌ COMPILE falló") error other -> Mix.shell().error("❌ COMPILE falló: #{inspect(other)}") {:error, other} end end, fn _ -> Mix.shell().cmd("MIX_ENV=test mix test --cover --color") end, fn _ -> case Mix.shell().cmd("MIX_ENV=test mix test", quiet: true) do 0 -> Mix.shell().info("✅ TEST terminado") 0 code -> Mix.shell().error("❌ TEST falló con código #{code}") # Re-ejecutar para mostrar los errores Mix.shell().cmd("MIX_ENV=test mix test", quiet: false) code end end, fn _ -> case Mix.Task.run("dialyzer", []) do :ok -> Mix.shell().info("✅ DIALYZER terminado") {:ok, _} -> Mix.shell().info("✅ DIALYZER terminado") {:error, _} = error -> Mix.shell().error("❌ DIALYZER falló") error other -> Mix.shell().error("❌ DIALYZER falló: #{inspect(other)}") {:error, other} end end ], bench: [ fn _ -> case Mix.Task.run("mix run bench", []) do :ok -> Mix.shell().info("✅ BENCHEE terminado") Mix.shell().info("✅✅✅✅ ESTO ES SOFTWARE DE CALIDAD ✅✅✅✅") {:ok, _} -> Mix.shell().info("✅ BENCHEE terminado") Mix.shell().info("✅✅✅✅ ESTO ES SOFTWARE DE CALIDAD ✅✅✅✅") {:error, _} = error -> Mix.shell().error("❌ BENCHEE falló") error other -> Mix.shell().error("❌ BENCHEE falló: #{inspect(other)}") {:error, other} end end ], hex_prepare: [ "quality", "docs", "cmd mix hex.build" ], hex_publish: [ "hex_prepare", "cmd mix hex.publish" ] ] end defp deps do [ {:benchee, "~> 1.3", only: :dev}, {:benchee_html, "~> 1.0", only: :dev}, {:changex, "~> 0.3.0"}, {:mix_test_watch, "~> 1.1", only: :dev, runtime: false}, {:propcheck, "~> 1.4", only: :test}, {:credo, "~> 1.7.11", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev], runtime: false}, {:ex_doc, "~> 0.34", runtime: false}, {:jason, "~> 1.4"} ] end def escript do [ main_module: Aurora.CLI ] end defp description do """ Aurora ofrece herramientas para formateo ANSI de textos en terminal, incluyendo colores, alineación y la capacidad de procesar textos en bloques o por trozos. Ideal para crear interfaces CLI/TUI limpias y dinámicas. """ end defp package do [ name: "aurora", licenses: ["Apache-2.0"], maintainers: ["Lorenzo Sánchez Fraile"], links: %{ "GitHub" => "https://github.com/lorenzo-sf/aurora", "Docs" => "https://hexdocs.pm/aurora" }, files: ~w(lib mix.exs README.md CHANGELOG.md LICENSE .dialyzer_ignore.exs) ] end end