Current section

Files

Jump to
Raw

mix.exs

defmodule LiveDebugger.MixProject do
  use Mix.Project

  @version "1.0.3"

  def project do
    [
      app: :live_debugger,
      version: @version,
      elixir: "~> 1.16",
      start_permanent: Mix.env() == :prod,
      elixirc_paths: elixirc_paths(Mix.env()),
      deps: deps(),
      aliases: aliases(),
      package: package(),
      name: "LiveDebugger",
      source_url: "https://github.com/software-mansion/live-debugger",
      description: "Tool for debugging LiveView applications",
      docs: docs(),
      test_coverage: [
        ignore_modules: [~r/^LiveDebuggerDev\./, DevWeb]
      ],
      listeners: [Phoenix.CodeReloader]
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger, :runtime_tools],
      mod: {LiveDebugger, []}
    ]
  end

  def cli() do
    [preferred_envs: [e2e: :test]]
  end

  defp elixirc_paths(:dev), do: ["lib", "dev"]

  defp elixirc_paths(:test),
    do: ["lib", "dev", "test/support"]

  defp elixirc_paths(_), do: ["lib"]

  defp aliases do
    [
      setup: [
        "deps.get",
        "cmd --cd assets/app npm install",
        "cmd --cd assets/client npm install",
        "assets.setup",
        "assets.build:dev"
      ],
      test: ["test"],
      "e2e.setup": [
        "cmd --cd e2e npm ci",
        "cmd --cd e2e npx playwright install --with-deps"
      ],
      e2e: ["cmd --cd e2e npx playwright test"],
      "assets.setup": ["esbuild.install --if-missing", "tailwind.install --if-missing"],
      "assets.build:deploy": [
        "esbuild build_app_js_deploy",
        "esbuild build_client_js_deploy",
        "esbuild build_client_css_deploy",
        "tailwind build_app_css_deploy"
      ],
      "assets.build:dev": [
        "esbuild build_app_js_dev",
        "esbuild build_client_js_dev",
        "esbuild build_client_css_dev",
        "tailwind build_app_css_dev"
      ]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:phoenix_live_view, "~> 1.1 and >= 1.1.7"},
      {:phoenix, "~> 1.7"},
      {:file_system, "~> 1.0"},
      {:igniter, "~> 0.5 and >= 0.5.40", optional: true},
      {:bandit, "~> 1.6", only: [:dev, :test]},
      {:phoenix_live_reload, "~> 1.5", only: :dev},
      {:phoenix_live_dashboard, "~> 0.8", only: [:dev, :test]},
      {:esbuild, "~> 0.7", only: :dev},
      {:tailwind, "~> 0.3", only: :dev},
      {:mox, "~> 1.2", only: :test},
      {:phx_new, "~> 1.7", only: :test},
      {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
      {:ex_doc, "~> 0.34", only: :dev, runtime: false}
    ]
  end

  defp docs() do
    [
      main: "welcome",
      logo: "./docs/images/logo.png",
      extra_section: "GUIDES",
      extras: [
        "CHANGELOG.md",
        "docs/welcome.md": [title: "Welcome to LiveDebugger"],
        "docs/features.md": [title: "Features Overview"],
        "docs/config.md": [title: "Configuration"],
        "docs/components_tree.md": [title: "Components Tree"],
        "docs/assigns_inspection.md": [title: "Assigns Inspection"],
        "docs/callback_tracing.md": [title: "Callback Tracing"],
        "docs/components_highlighting.md": [title: "Components Highlighting"],
        "docs/dead_view_mode.md": [title: "DeadView Mode"],
        "docs/elements_inspection.md": [title: "Elements Inspection"],
        "docs/open_in_editor.md": [title: "Open in Editor"]
      ],
      groups_for_extras: [
        Features: [
          "docs/features.md",
          "docs/assigns_inspection.md",
          "docs/components_tree.md",
          "docs/callback_tracing.md",
          "docs/components_highlighting.md",
          "docs/dead_view_mode.md",
          "docs/elements_inspection.md",
          "docs/open_in_editor.md"
        ]
      ],
      source_url: "https://github.com/software-mansion/live-debugger",
      homepage_url: "https://docs.swmansion.com/live-debugger/",
      source_ref: "v#{@version}",
      api_reference: false,
      assets: %{
        Path.expand("./docs/images") => "images"
      },
      filter_modules: fn module, _meta ->
        module == Mix.Tasks.LiveDebugger.Install
      end
    ]
  end

  defp package do
    [
      licenses: ["Apache-2.0"],
      links: %{
        "Website" => "https://docs.swmansion.com/live-debugger/",
        "GitHub" => "https://github.com/software-mansion/live-debugger",
        "Changelog" => "https://hexdocs.pm/live_debugger/changelog.html"
      },
      files: ~w(lib priv LICENSE mix.exs README.md CHANGELOG.md)
    ]
  end
end