defmodule Managoat.Docs.MixProject do use Mix.Project @version "0.1.0" @source_url "https://github.com/managoat/managoat_docs" def project do [ app: :managoat_docs, version: @version, elixir: "~> 1.18", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), description: "A documentation manual embedded at compile time for a Phoenix app to serve, its sanitising markdown renderer, and the guardrail tests that keep it sound.", package: package(), source_url: @source_url, docs: docs(), dialyzer: dialyzer(), test_coverage: [ # What this suite measures on its own: the compiler, the renderer and # the checks, driven by the fixture manual. Raise it as the library's # own tests grow; never lower it. summary: [threshold: 90], # The two `use` macros run at test-compile time, before cover # instruments anything, so they always report 0%. They are exercised # by the fixture module and by docs_test.exs (and by every host's # guardrail file) rather than measured. ignore_modules: [Managoat.Docs, Managoat.Docs.GuardrailCase] ] ] end def application do [extra_applications: [:logger]] end # The fixture manual's docs module lives in test/support: it `use`s the # macro against test/fixtures/manual, so it is a test-only compile. defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] defp deps do [ # Tooling for the repository, not the package: docs for hexdocs.pm (built # by `mix hex.publish`), credo and dialyzer for CI. dialyxir is pinned to # the commit that added OTP 28 support; 1.4.7 crashes on OTP 28 warnings. {:ex_doc, "~> 0.34", only: :dev, runtime: false}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, github: "jeremyjh/dialyxir", ref: "3553678f4d69281ac6db61034bcf35bcb30cfd78", only: [:dev, :test], runtime: false}, # comrak, through MDEx. Every page renders through it, both paths. {:mdex, "~> 0.13.5"}, # Syntax highlighting for the trusted path. Called directly rather than # through MDEx's integration, which needs a NIF build an order of # magnitude larger (147 MB unpacked against 12 MB); see # `Managoat.Docs.Markdown`. {:lumis, "~> 0.7"}, # The pre-encoded search index. {:jason, "~> 1.2"} ] end defp package do [ licenses: ["Apache-2.0"], links: %{"GitHub" => @source_url, "Changelog" => "#{@source_url}/blob/main/CHANGELOG.md"}, files: ~w(lib mix.exs README.md CHANGELOG.md LICENSE NOTICE) ] end defp docs do [ main: "readme", extras: ["README.md", "CHANGELOG.md"], source_ref: "v#{@version}", source_url: @source_url ] end defp dialyzer do [ ignore_warnings: ".dialyzer_ignore.exs", # A fixed path so CI can cache the PLT across runs. plt_file: {:no_warn, "priv/plts/dialyzer.plt"} ] end end