defmodule DotCom.Mixfile do
  @moduledoc false
  use Mix.Project

  def project do
    [
      # app and version expected by `mix compile.app`
      app: :dotcom,
      version: "0.0.1",
      elixir: "~> 1.17",
      elixirc_paths: elixirc_paths(Mix.env()),
      compilers: Mix.compilers(),
      # configures `mix compile` to embed all code and priv content in the _build directory instead of using symlinks
      build_embedded: Mix.env() == :prod,
      # used by `mix app.start` to start the application and children in permanent mode, which guarantees the node will shut down if the application terminates (typically because its root supervisor has terminated).
      start_permanent: Mix.env() == :prod,
      test_coverage: [tool: ExCoveralls],
      preferred_cli_env: [
        coveralls: :test,
        "coveralls.html": :test,
        "gettext.extract": :prod,
        "gettext.translate": :prod
      ],
      dialyzer: [
        plt_add_apps: [:mix, :phoenix_live_reload],
        flags: [:unmatched_returns]
      ],
      deps: deps(),
      listeners: [Phoenix.CodeReloader],
      # docs
      name: "MBTA Website",
      source_url: "https://github.com/mbta/dotcom",
      homepage_url: "https://www.mbta.com/",
      # The main page in the docs
      docs: [logo: "priv/static/images/mbta-logo-t.png"]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:dev),
    do: [
      "lib",
      "test/support/factories",
      "test/support/factory_helpers.ex",
      "test/support/generators"
    ]

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

  # Configuration for the OTP application generated by `mix compile.app`
  def application do
    extra_apps = [
      :logger,
      :runtime_tools,
      :os_mon
    ]

    extra_apps =
      if Mix.env() == :prod do
        [:sasl | extra_apps]
      else
        extra_apps
      end

    [
      # the module to invoke when the application is started
      mod: {Dotcom.Application, []},
      # a list of OTP applications your application depends on which are not included in :deps
      extra_applications: extra_apps
    ]
  end

  # You can check the status of each dependency by running `mix hex.outdated`.
  # Dependencies that cannot be updated are noted in comments.
  # Note that you should also update `.github/dependabot.yml` and remove ignore overrides for any dependencies you update.
  defp deps do
    [
      {:absinthe_client, "0.1.1"},
      {:address_us, "0.4.3"},
      {:aws, "1.0.9"},
      {:aws_credentials, "0.3.5", optional: true},
      {:browser, "0.5.5"},
      {:castore, "1.0.15"},
      {
        :content_security_policy,
        git: "https://github.com/unill-io/content_security_policy.git", tag: "v1.1.1"
      },
      {:cowlib, "2.16.0", override: true},
      {:crc, "0.10.5"},
      {:credo, "1.7.12", only: [:dev, :test]},
      {:csv, "3.2.2"},
      {:cva, "0.2.2"},
      {:decorator, "1.4.0"},
      {:dialyxir, "1.4.6", [only: [:dev, :test], runtime: false]},
      {:diskusage_logger, "0.2.0"},
      {:ecto, "3.13.3"},
      {:eextoheex, git: "https://github.com/Multiverse-io/eextoheex", only: [:dev, :test]},
      {:eflame, "1.0.1", only: :dev},
      {:ehmon, [github: "mbta/ehmon", only: :prod]},
      {:ex_cldr, "2.43.2"},
      {:ex_cldr_dates_times, "2.24.0"},
      {:ex_cldr_lists, "2.11.1"},
      {:ex_cldr_units, "3.19.1"},
      {:ex_doc, "0.38.4", only: :dev},
      {:ex_machina, "2.8.0", only: [:dev, :test]},
      {:ex_unit_summary, "0.1.0", only: [:dev, :test]},
      {:excoveralls, "0.18.5", only: :test},
      {:faker, "0.19.0-alpha.1", only: [:dev, :test]},
      {:floki, "0.38.0"},
      {:gen_stage, "1.3.2"},
      {:gettext, "1.0.0", override: true},
      {:hackney, "1.25.0"},
      {:hammer, "7.1.0"},
      {:html_sanitize_ex, "1.4.3"},
      {:httpoison, "2.2.3"},
      {:inflex, github: "warmwaffles/inflex", branch: "master", override: true},
      {:jason, "1.4.4", override: true},
      {:kino_live_component, "0.0.5"},
      {:lazy_html, "0.1.8", only: [:test]},
      {:logster, "1.1.1"},
      # reverted from 0.4
      {:mail, "0.3.1"},
      {:mbta_metro, "0.3.3"},
      {:mock, "0.3.9", [only: :test]},
      {:mox, "1.2.0", [only: [:dev, :test]]},
      {:msgpack, "0.8.1"},
      {:nebulex, "2.6.5"},
      {:nebulex_redis_adapter, "2.4.2"},
      {
        :open_trip_planner_client,
        [github: "mbta/open_trip_planner_client", tag: "v0.17.1"]
      },
      {:parallel_stream, "1.1.0"},
      {:phoenix, "1.8.1"},
      {:phoenix_ecto, "4.6.5"},
      {:phoenix_html_helpers, "1.0.1"},
      {:phoenix_live_dashboard, "0.8.7"},
      {:phoenix_live_reload, "1.6.1", only: [:dev, :test]},
      {:phoenix_live_view, "1.1.13", override: true},
      {:phoenix_pubsub, "2.1.3"},
      {:phoenix_view, "2.0.4"},
      {:plug, "1.18.1"},
      {:plug_cowboy, "2.7.4"},
      {:poison, "6.0.0"},
      {:polyline, "1.6.0"},
      {:progress_bar, "3.0.0"},
      # Needed for rstar; workaround for mix local.hex bug
      {:proper, "1.5.0"},
      {:quixir, "0.9.3", [only: :test]},
      {:recaptcha, "3.1.0"},
      {:recase, "0.9.0"},
      {:recon, "2.5.6", [only: :prod]},
      {:redix, "1.5.2"},
      {:req, "0.5.15"},
      {:rstar, github: "armon/erl-rstar"},
      {:sentry, "11.0.4"},
      {:server_sent_event_stage, "1.2.1"},
      {:sizeable, "1.0.2"},
      {:stream_data, "1.2.0", only: [:dev, :test]},
      {:sweet_xml, "0.7.5", only: [:dev, :prod]},
      {:telemetry, "1.3.0", override: true},
      {:telemetry_metrics, "1.1.0", override: true},
      {:telemetry_metrics_splunk, "0.0.6-alpha"},
      {:telemetry_poller, "1.3.0"},
      {:telemetry_test, "0.1.2", only: [:test]},
      {:timex, git: "https://github.com/bitwalker/timex.git", override: true, branch: "main"},
      {:topo, "~> 1.0"},
      {:typed_ecto_schema, "0.4.3"},
      {:unrooted_polytree, "0.1.1"},
      {:uuid, "1.1.8"},
      {:wallaby, "0.30.10", [runtime: false, only: [:dev, :test]]},
      {:yaml_elixir, "2.12.0", only: [:dev]},
      {:ymlr, "5.1.4", only: [:dev]}
    ]
  end
end
