defmodule PhoenixKitManufacturing.MixProject do use Mix.Project @version "0.3.2" @source_url "https://github.com/BeamLabEU/phoenix_kit_manufacturing" def project do [ app: :phoenix_kit_manufacturing, version: @version, elixir: "~> 1.18", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), description: "Manufacturing module for PhoenixKit — machines, production orders.", package: package(), dialyzer: [ plt_add_apps: [ :phoenix_kit, :phoenix_kit_comments, :phoenix_kit_entities, :phoenix_kit_locations ] ], name: "PhoenixKitManufacturing", source_url: @source_url, docs: docs(), aliases: aliases() ] end def application do [ extra_applications: [:logger, :phoenix_kit, :phoenix_kit_comments, :phoenix_kit_locations] ] end 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"], # Schema is applied by test/test_helper.exs on every `mix test` run via # PhoenixKit.Migration.ensure_current/2 — so there is no `ecto.migrate` step here. "test.setup": ["ecto.create --quiet -r PhoenixKitManufacturing.Test.Repo"], "test.reset": [ "ecto.drop --quiet -r PhoenixKitManufacturing.Test.Repo", "test.setup" ], precommit: [ "compile --force --warnings-as-errors", "deps.unlock --check-unused", "cmd mix hex.audit", "quality.ci" ] ] end # phoenix_kit (and sibling phoenix_kit_* deps) resolve from Hex by default. # For cross-repo work against a local checkout — e.g. an unpublished core # change — export `_PATH` (e.g. `PHOENIX_KIT_PATH=../phoenix_kit`) and # Mix swaps the Hex pin for a `path:` + `override: true` dep at resolve time. # Unset => the published pin, so `mix hex.publish` and CI resolve unchanged. 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 deps do [ # The manufacturing DB tables ship in core migration V144 (renumbered # from V143 at merge time), first published in phoenix_kit 1.7.190 # (1.7.189 tops out at V142); >= 1.7.189 would cover the runtime # schema-prefix support, but the tables need 1.7.190. pk_dep(:phoenix_kit, "~> 1.7.190"), pk_dep(:phoenix_kit_comments, "~> 0.2"), pk_dep(:phoenix_kit_entities, "~> 0.2.7"), # PlacePicker / Spaces.full_path shipped in phoenix_kit_locations 0.3.0. # For unpublished local changes: PHOENIX_KIT_LOCATIONS_PATH=../phoenix_kit_locations. pk_dep(:phoenix_kit_locations, "~> 0.3"), {:phoenix_live_view, "~> 1.1"}, {:ex_doc, "~> 0.39", only: :dev, runtime: false}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, {:lazy_html, ">= 0.1.0", only: :test} ] end defp package do [ licenses: ["MIT"], links: %{"GitHub" => @source_url}, files: ~w(lib .formatter.exs mix.exs README.md CHANGELOG.md LICENSE) ] end defp docs do [ main: "PhoenixKitManufacturing", source_ref: @version ] end end