defmodule Kepler.MixProject do use Mix.Project @version "0.1.0" @source_url "https://github.com/houllette/kepler" @description """ An event router that lives inside your Elixir app. Declare the occurrences \ you care about; Kepler enriches them with in-VM context and delivers them \ to an external consumer.\ """ def project do [ app: :kepler, version: @version, elixir: "~> 1.18", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), aliases: aliases(), name: "Kepler", description: @description, package: package(), docs: docs(), source_url: @source_url, dialyzer: [ plt_file: {:no_warn, "priv/plts/dialyzer.plt"}, # Every OTP app Kepler calls into directly. `plt_add_apps` does not # resolve transitive dependencies, so :public_key has to be named even # though :ssl implies it — Kepler.Transport.Httpc calls it itself. plt_add_apps: [:ex_unit, :mix, :inets, :ssl, :public_key, :crypto] ], usage_rules: [file: "AGENTS.md", usage_rules: :all] ] end def cli do [preferred_envs: [precommit: :test]] end def application do [ extra_applications: [:logger, :crypto], mod: {Kepler.Application, []} ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_env), do: ["lib"] defp deps do [ # The only runtime dependency, by design. Everything else is dev/test. {:telemetry, "~> 1.0"}, {:tidewave, "~> 0.8", only: :dev}, {:bandit, "~> 1.0", only: :dev}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, {:mix_audit, "~> 2.1", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.40", only: [:dev, :test], runtime: false}, {:usage_rules, "~> 1.2", only: [:dev, :test], runtime: false} ] end defp package do [ licenses: ["MIT"], links: %{ "GitHub" => @source_url, "Changelog" => "#{@source_url}/blob/main/CHANGELOG.md" }, files: ~w(lib guides mix.exs README.md LICENSE CHANGELOG.md) ] end defp docs do [ main: "readme", source_ref: "v#{@version}", source_url: @source_url, extras: [ "README.md", "guides/getting_started.md", "guides/crash_attribution.md", "guides/writing_watches.md", "guides/sinks_and_payloads.md", "guides/performance.md", "guides/testing.md", "CHANGELOG.md" ], groups_for_extras: [ Guides: ~r{guides/} ], groups_for_modules: [ "Declaring watches": [Kepler, Kepler.Watch, Kepler.Context, Kepler.CompileError], Sources: [ Kepler.Source.Report, Kepler.Source.Telemetry, Kepler.Source.Process, Kepler.Source.VM, Kepler.SystemMonitor ], "Events and delivery": [ Kepler.Event, Kepler.Sink, Kepler.Sink.Webhook, Kepler.Sink.Callback, Kepler.Transport, Kepler.Transport.Httpc ], Internals: [ Kepler.Budget, Kepler.Emitter, Kepler.Histogram, Kepler.Poller, Kepler.RingBuffer, Kepler.Trigger ] ], nest_modules_by_prefix: [Kepler.Sink, Kepler.Source, Kepler.Transport] ] end defp aliases do [ tidewave: "run --no-halt -e 'Agent.start(fn -> Bandit.start_link(plug: Tidewave, port: 4000) end)'", precommit: [ "deps.unlock --check-unused", "hex.audit", "deps.audit", "compile --warnings-as-errors", "format", "credo --strict", "usage_rules.sync --yes", "xref graph --label compile-connected --fail-above 0", "docs --warnings-as-errors", "test --warnings-as-errors" ] ] end end