defmodule AshPaperPlane.MixProject do use Mix.Project @version "0.1.0" @source_url "https://github.com/byu/ash_paper_plane" @changelog_url "#{@source_url}/blob/main/CHANGELOG.md" def project do [ app: :ash_paper_plane, version: @version, elixir: "~> 1.15", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), description: description(), package: package(), source_url: @source_url, docs: docs() ] end def cli do [preferred_envs: [precommit: :test]] end # Run "mix help compile.app" to learn about applications. def application do [] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_env), do: ["lib"] defp aliases do [ precommit: [ "compile --warnings-as-errors", "deps.unlock --unused", "format", "credo --strict", "docs", "test" ], test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"] ] end defp description do "AshPaperTrail extension that lifts action context onto a version's " <> "metadata and enqueues an Oban job when the version is created." end defp package do [ licenses: ["MIT"], links: %{"GitHub" => @source_url, "Changelog" => @changelog_url}, files: ~w(lib mix.exs README.md CHANGELOG.md LICENSE .formatter.exs) ] end # `precommit` runs `docs` under `MIX_ENV=test`, where `elixirc_paths` compiles # `test/support`. Without this the case template, the repo, and the version # resources AshPaperTrail generates from the fixtures all ship as public API. defp docs do [ main: "readme", extras: ["README.md", "CHANGELOG.md"], source_ref: "v#{@version}", filter_modules: ~r/^Elixir\.AshPaperPlane(\.(EnqueueObanJob|SetVersionMetadata|VersionMixin))?$/ ] end # Run "mix help deps" to learn about dependencies. defp deps do [ # `ash_paper_trail`'s own Ash requirement, adopted verbatim. This library # extends it, so it cannot outlive the Ash range its host supports. Copy # the requirement across whenever the `ash_paper_trail` bound moves. {:ash, "~> 3.5 and >= 3.5.43"}, {:ash_paper_trail, "~> 0.6"}, # A data layer that opens a transaction, so the test suite can prove the # enqueue rides one. The library itself is data-layer agnostic. {:ash_postgres, "~> 2.10", only: :test}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.40", only: [:dev, :test], runtime: false, warn_if_outdated: true}, {:oban, "~> 2.20"}, # `ash_postgres` requires postgrex outright, so this only pins it to the # version `oban` asks for rather than reaching for whatever resolves. {:postgrex, "~> 0.20", only: :test} ] end end