defmodule Sublimate.MixProject do use Mix.Project @source_url "https://codeberg.org/ArthurClemens/sublimate" def project do [ app: :sublimate, name: "Sublimate", description: "Builds database trigger logic for incremental updates to a destination table.", version: "0.1.2", elixir: "~> 1.17", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), aliases: aliases(), deps: deps(), docs: docs(), package: package(), dialyzer: [plt_add_apps: [:mix, :ex_unit]], test_pattern: "*_test.{exs}", test_coverage: [tool: ExCoveralls], preferred_cli_env: [ "coveralls.detail": :test, coveralls: :test ] ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] defp deps do [ {:ecto_sql, "~> 3.11"}, {:postgrex, "~> 0.15"}, # dev / test {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev], runtime: false}, {:ex_doc, "~> 0.40", only: :dev, runtime: false}, {:excoveralls, "~> 0.18", only: :test}, {:recode, "~> 0.7", only: [:dev, :test], runtime: false}, {:sobelow, "~> 0.14", only: [:dev, :test], runtime: false} ] end defp docs do [ groups_for_docs: [ "Callbacks: deltas table shape": &(&1[:group] == :callbacks_deltas_table_shape), "Callbacks: generation": &(&1[:group] == :callbacks_generation), "Callbacks: merge": &(&1[:group] == :callbacks_merge), "Callbacks: trigger bodies": &(&1[:group] == :callbacks_trigger_bodies), "Database functions": &(&1[:group] == :database_functions), Helpers: &(&1[:group] == :helpers), Lifecycle: &(&1[:group] == :lifecycle), "Name handling": &(&1[:group] == :name_handling), "Option handling": &(&1[:group] == :database_options), "Projection data": &(&1[:group] == :projection_data), "Projection helpers": &(&1[:group] == :projection_helpers), Projection: &(&1[:group] == :projection), "SQL generation": &(&1[:group] == :sql_generation), "Table properties": &(&1[:group] == :table_properties) ] ] end defp package do [ licenses: ["MIT"], links: %{ "Codeberg" => @source_url, "Changelog" => @source_url <> "/src/branch/main/CHANGELOG.md" }, files: ~w(lib mix.exs README* LICENSE* CHANGELOG*) ] end defp aliases do [ # Quality checks qa: [ "typecheck", "deps.clean --unlock --unused", "format", "format --check-formatted", "compile", "docs", "sobelow --config", "credo --strict" ], prepublish: "cmd ./scripts/prepublish.sh", typecheck: "dialyzer --format dialyzer", # Test tasks ## Call with MIX_ENV=test init_test_repo: ["ecto.create --quiet --repo Sublimate.Test.Repo"], destroy_test_repo: [ "ecto.drop --quiet --force-drop --repo Sublimate.Test.Repo" ] ## Test coverage: ## mix test --cover ## mix coveralls.detail ] end end