Packages

Privacy-first, cookieless web analytics module for PhoenixKit — server-side page view tracking with no client-side JavaScript required

Current section

Files

Jump to

mix.exs

defmodule PhoenixKitWebAnalytics.MixProject do
use Mix.Project
@version "0.2.1"
@source_url "https://github.com/BeamLabEU/phoenix_kit_web_analytics"
def project do
[
app: :phoenix_kit_web_analytics,
version: @version,
elixir: "~> 1.18",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
aliases: aliases(),
# Hex
description:
"Privacy-first, cookieless web analytics module for PhoenixKit — server-side page view " <>
"tracking with no client-side JavaScript required",
package: package(),
# Dialyzer
dialyzer: [plt_add_apps: [:phoenix_kit, :mix]],
# Docs
name: "PhoenixKitWebAnalytics",
source_url: @source_url,
homepage_url: @source_url,
docs: docs()
]
end
def application do
[
extra_applications: [:logger]
]
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 PhoenixKitWebAnalytics.Test.Repo"
],
"test.reset": [
"ecto.drop --quiet -r PhoenixKitWebAnalytics.Test.Repo",
"test.setup"
]
]
end
# phoenix_kit deps resolve from Hex by default. For cross-repo work against a
# local checkout, export <APP>_PATH — e.g. PHOENIX_KIT_PATH=../phoenix_kit.
# Unset => the published pin, so mix hex.publish is 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 deps do
[
# PhoenixKit provides the Module behaviour, Settings API, RepoHelper, the
# admin shell, and `PhoenixKit.Migrations.Postgres.Helpers` (used by the
# migration coordinator). 1.7.189 adds the runtime schema-prefix support
# `PhoenixKit.SchemaPrefix` relies on.
pk_dep(:phoenix_kit, "~> 2.0"),
# Admin LiveViews.
{:phoenix_live_view, "~> 1.1"},
# The tracking plug and the beacon/pixel controller.
{:plug, "~> 1.15"},
# Event + rollup schemas and the aggregation queries.
{:ecto_sql, "~> 3.10"},
{:ex_doc, "~> 0.34", only: :dev, runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
# HTML parser for Phoenix.LiveViewTest in LiveView smoke tests
{:lazy_html, ">= 0.1.0", only: :test}
]
end
defp package do
[
licenses: ["MIT"],
links: %{"GitHub" => @source_url},
# No `priv` — this package has no priv/ directory, and listing a missing
# path makes `mix hex.build` refuse ("Missing files: priv"), which is why
# no release of this package ever reached Hex. Add it back if priv/ ever
# gains content.
files: ~w(lib .formatter.exs mix.exs README.md CHANGELOG.md LICENSE)
]
end
defp docs do
[
main: "readme",
# Tags in this repo are bare version numbers, not v-prefixed — a "v" ref
# points at a tag that does not exist and 404s every HexDocs source link.
source_ref: @version,
extras: ["README.md", "CHANGELOG.md"]
]
end
end