defmodule PhoenixKitCRM.MixProject do use Mix.Project @version "0.2.4" @source_url "https://github.com/BeamLabEU/phoenix_kit_crm" def project do [ app: :phoenix_kit_crm, version: @version, elixir: "~> 1.18", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), aliases: aliases(), # Hex description: "CRM module for PhoenixKit — organization accounts, role-scoped user views, and per-user column configuration.", package: package(), # Dialyzer dialyzer: [plt_add_apps: [:phoenix_kit], ignore_warnings: ".dialyzer_ignore.exs"], # Docs name: "PhoenixKitCRM", source_url: @source_url, docs: docs() ] end def application do [ extra_applications: [:logger, :gettext, :phoenix_kit] ] end def cli do [preferred_envs: [test: :test, "test.setup": :test, "test.reset": :test]] end # test/support/ is compiled only in :test so DataCase and TestRepo # don't leak into the published package. defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] defp aliases do [ quality: ["format", "credo --strict", "dialyzer"], "quality.ci": ["format --check-formatted", "credo --strict", "dialyzer"], precommit: [ "compile --force --warnings-as-errors", "deps.unlock --check-unused", # Scan for retired Hex deps. Run via `cmd` so Hex bootstraps in a fresh # process — the hex.* archive tasks aren't resolvable via Mix.Task.run # inside an alias. "cmd mix hex.audit", "quality.ci" ], "test.setup": [ "ecto.create --quiet -r PhoenixKitCRM.Test.Repo", "ecto.migrate -r PhoenixKitCRM.Test.Repo" ], "test.reset": [ "ecto.drop --quiet -r PhoenixKitCRM.Test.Repo", "test.setup" ] ] end defp deps do [ # PhoenixKit provides the Module behaviour, Settings API, RepoHelper, # Dashboard tabs, and the admin layout this module renders into. pk_dep(:phoenix_kit, "~> 1.7"), # Hard, compile-time dep for the contact profile's Comments tab # (`use PhoenixKitComments.Embed` + CommentsComponent). Runtime-gated on # the module's admin toggle, so the tab hides when comments is disabled. pk_dep(:phoenix_kit_comments, "~> 0.2"), # Per-module i18n — own Gettext backend for sidebar tab labels. {:gettext, "~> 1.0"}, # LiveView is needed for the admin pages. {:phoenix_live_view, "~> 1.1"}, # Ecto for the role-settings and per-user view-config schemas. {:ecto_sql, "~> 3.13"}, # Optional: add ex_doc for generating documentation {:ex_doc, "~> 0.34", only: :dev, runtime: false}, # Code quality {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, # `Phoenix.LiveViewTest` parses HTML via `lazy_html` for `element/2`, # `render(view) =~ "..."`, etc. Test-only. {:lazy_html, ">= 0.1.0", only: :test} ] end # A phoenix_kit* dependency that can be swapped for a local checkout by # exporting _PATH (e.g. `PHOENIX_KIT_PATH=../phoenix_kit mix test`) so the # suite runs against unpublished local core (needed while the CRM tables # migration is unreleased). Unset → the published Hex pin, so publish/CI are # unaffected. defp pk_dep(app, requirement, opts \\ []) do env_var = String.upcase(Atom.to_string(app)) <> "_PATH" case System.get_env(env_var) do nil when opts == [] -> {app, requirement} nil -> {app, requirement, opts} path -> {app, [path: path, override: true] ++ opts} end end defp package do [ licenses: ["MIT"], links: %{"GitHub" => @source_url}, files: ~w(lib priv .formatter.exs mix.exs README.md CHANGELOG.md LICENSE) ] end defp docs do [ main: "PhoenixKitCRM", source_ref: "v#{@version}" ] end end