defmodule Oban.Pro.MixProject do use Mix.Project @version "1.7.7" def project do [ app: :oban_pro, version: @version, elixir: "~> 1.15", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), elixirc_options: [no_warn_undefined: [Oban.JSON, Oban.Validation]], test_ignore_filters: [~r/fixture_app/], prune_code_paths: false, deps: deps(), docs: docs(), aliases: aliases(), package: package(), name: "Oban Pro", description: "Oban Pro Component", # Dialyzer dialyzer: [ plt_add_apps: [:ex_unit, :inets, :mix, :postgrex], plt_core_path: "_build/#{Mix.env()}", flags: [:error_handling, :missing_return, :no_opaque, :underspecs] ] ] end def application do [ extra_applications: [:logger], mod: {Oban.Pro.Application, []} ] end def cli do [ preferred_envs: [ precommit: :test, "test.ci": :test, "test.reset": :test, "test.rollback": :test, "test.setup": :test ] ] end def package do [ organization: "oban", files: ~w(lib/oban usage-rules .formatter.exs mix.exs usage-rules.md), licenses: ["Commercial"], links: [] ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_env), do: ["lib"] defp deps do [ {:oban, "~> 2.21"}, {:ecto_sql, "~> 3.12"}, {:postgrex, "~> 0.22", optional: true}, {:decimal, "~> 3.0", optional: true}, # Test and Dev {:stream_data, "~> 1.1", only: [:test, :dev]}, {:tz, "~> 0.28", only: [:test, :dev]}, {:benchee, "~> 1.5", only: [:test, :dev], runtime: false}, {:credo, "~> 1.7.17", only: [:test, :dev], runtime: false}, {:dialyxir, "~> 1.4", only: [:test, :dev], runtime: false}, # Dev {:ex_doc, "~> 0.40", only: :dev, runtime: false}, {:makeup_diff, "~> 0.1", only: :dev, runtime: false} ] end defp aliases do [ release: [ "cmd git tag v#{@version}", "cmd git push", "cmd git push --tags", "oban_pro.release", "hex.publish package --yes" ], "db.reset": ["ecto.drop -r Oban.Pro.Repo --quiet", "db.setup"], "db.rollback": ["ecto.rollback -r Oban.Pro.Repo --all --quiet"], "db.setup": [ "ecto.create -r Oban.Pro.Repo --quiet", "ecto.migrate -r Oban.Pro.Repo --quiet" ], "test.ci": [ fn _ -> System.put_env("CI", "true") end, "format --check-formatted", "deps.unlock --check-unused", "credo --strict", "test --raise", "dialyzer" ], "test.reset": ["db.reset"], precommit: [ "format --check-formatted", "deps.unlock --check-unused", "credo --strict", "test --raise" ] ] end defp docs do [ main: "overview", source_ref: "v#{@version}", formatters: ["html"], api_reference: false, extra_section: "GUIDES", extras: extras(), groups_for_extras: groups_for_extras(), groups_for_modules: groups_for_modules(), homepage_url: "/", logo: "assets/oban-pro-logo.svg", assets: %{"assets" => "assets"}, nest_modules_by_prefix: nest_modules_by_prefix(), skip_undefined_reference_warnings_on: [ "CHANGELOG.md", "guides/upgrading/v1.5.md", "guides/upgrading/v1.7.md" ], before_closing_body_tag: fn _ -> """ """ end ] end defp extras do [ "guides/introduction/overview.md", "guides/introduction/installation.md", "guides/introduction/adoption.md", "guides/introduction/composition.md", "guides/testing/testing.md", "guides/testing/testing_workers.md", "guides/deployment/ci_cd.md", "guides/deployment/docker.md", "guides/deployment/fly.md", "guides/deployment/gigalixir.md", "guides/deployment/heroku.md", "guides/deployment/dependabot.md", "guides/upgrading/v1.0.md", "guides/upgrading/v1.4.md", "guides/upgrading/v1.5.md", "guides/upgrading/v1.6.md", "guides/upgrading/v1.7.md", "CHANGELOG.md": [filename: "changelog", title: "Changelog"] ] end defp groups_for_extras do [ Introduction: ~r/guides\/introduction\/.?/, Testing: ~r/guides\/testing\/.?/, Deployment: ~r/guides\/deployment\/.?/, Upgrading: ~r/guides\/upgrading\/.?/ ] end defp groups_for_modules do [ Workers: [ Oban.Pro.Worker, Oban.Pro.Decorator ], Composition: [ Oban.Pro.Batch, Oban.Pro.Chunk, Oban.Pro.Workflow ], Utilities: [ Oban.Pro.Cloud, Oban.Pro.RateLimit, Oban.Pro.Relay, Oban.Pro.Testing ], Plugins: [ Oban.Pro.Plugins.DynamicCron, Oban.Pro.Plugins.DynamicLifeline, Oban.Pro.Plugins.DynamicPartitioner, Oban.Pro.Plugins.DynamicPrioritizer, Oban.Pro.Plugins.DynamicPruner, Oban.Pro.Plugins.DynamicQueues, Oban.Pro.Plugins.DynamicScaler ] ] end defp nest_modules_by_prefix do [Oban.Pro, Oban.Pro.Plugins] end end