defmodule CooperConfig.MixProject do use Mix.Project @version "0.2.0" # `mix precommit` includes `test` as a step; without this, Mix runs # the whole alias chain (including `mix test`) in :dev, and `mix test` # itself refuses to run outside :test when invoked as a sub-task # rather than the top-level command. def cli do [preferred_envs: [precommit: :test]] end def project do [ app: :cooper_config, version: @version, elixir: "~> 1.19", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), deps: deps(), description: description(), package: package(), name: "CooperConfig", docs: docs(), aliases: aliases(), test_coverage: [tool: ExCoveralls], dialyzer: [plt_add_apps: [:mix]] ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] def application do [ extra_applications: [:logger] ] end defp deps do [ # === CODE QUALITY & STATIC ANALYSIS === {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, {:sobelow, "~> 0.14", only: [:dev, :test], runtime: false}, {:excoveralls, "~> 0.18", only: [:dev, :test], runtime: false}, # Credo is invoked via `mix credo` # Dialyzer is invoked via `mix dialyzer` # Sobelow is invoked via `mix sobelow` # === TESTING === {:stream_data, "~> 1.4", only: [:test]}, # === DEVELOPMENT TOOLING === # Mix, and Hex are built-in (no deps needed) {:ex_doc, "~> 0.40", only: [:dev], runtime: false}, # ExDoc is invoked via `mix docs` # === RUNTIME === # `~> 0.3`, not `~> 0.2`: this library now validates option names against # an enumerated list that includes `:dotenv_override`, which only exists # from Cooper 0.3.0. Allowing an older Cooper would let it accept an # option the installed Cooper silently ignores -- the exact failure this # validation was added to prevent. {:cooper, "~> 0.3"} ] end # Fast/cheap checks first so a broken commit fails quickly; dialyzer # (slowest, especially its first PLT build) runs last. defp aliases do [ precommit: [ "format", "compile --warnings-as-errors", "credo --strict", "sobelow", "test", "dialyzer" ] ] end defp description do "A Config.Provider that loads app config from a CASC file (via Cooper) at " <> "release boot, replacing Mix's compile-time config.exs/runtime.exs for the " <> "settings that need to come from CASC instead." end defp package do [ licenses: ["MIT"], links: %{ "GitHub" => "https://github.com/joetjen/cooper_config", "Docs (main)" => "https://joetjen.github.io/cooper_config/" }, files: ~w(lib .formatter.exs mix.exs README.md CHANGELOG.md LICENSE) ] end # `canonical` points search engines/ExDoc's own "View on hexdocs.pm"-style # link at the released docs, since the same docs are also built on every # push to main and published to GitHub Pages (.github/workflows/docs.yml) # as an unreleased-changes preview -- without it the two copies would look # like duplicate content, and one would fork as "canonical" arbitrarily. defp docs do [ main: "readme", source_url: "https://github.com/joetjen/cooper_config", source_ref: "v#{@version}", canonical: "https://hexdocs.pm/cooper_config", extras: ["README.md", "CHANGELOG.md", "LICENSE"], groups_for_modules: groups_for_modules() ] end defp groups_for_modules do [ "Public API": [ CooperConfig, CooperConfig.Provider, CooperConfig.Convert ] ] end end