mirror of
https://github.com/ash-project/ash_money.git
synced 2024-09-21 05:43:02 +12:00
180 lines
4.4 KiB
Elixir
180 lines
4.4 KiB
Elixir
defmodule AshMoney.MixProject do
|
|
use Mix.Project
|
|
|
|
@version "0.1.2"
|
|
|
|
@description """
|
|
A money extension for Ash.
|
|
"""
|
|
|
|
def project do
|
|
[
|
|
app: :ash_money,
|
|
version: @version,
|
|
elixir: "~> 1.15",
|
|
start_permanent: Mix.env() == :prod,
|
|
deps: deps(),
|
|
aliases: aliases(),
|
|
package: package(),
|
|
elixirc_paths: elixirc_paths(Mix.env()),
|
|
dialyzer: [plt_add_apps: [:ash]],
|
|
test_coverage: [tool: ExCoveralls],
|
|
preferred_cli_env: [
|
|
coveralls: :test,
|
|
"coveralls.github": :test
|
|
],
|
|
docs: docs(),
|
|
description: @description,
|
|
source_url: "https://github.com/ash-project/ash_money",
|
|
homepage_url: "https://github.com/ash-project/ash_money"
|
|
]
|
|
end
|
|
|
|
# Run "mix help compile.app" to learn about applications.
|
|
def application do
|
|
[
|
|
extra_applications: [:logger]
|
|
]
|
|
end
|
|
|
|
defp package do
|
|
[
|
|
name: :ash_money,
|
|
licenses: ["MIT"],
|
|
files: ~w(lib .formatter.exs mix.exs README* LICENSE*
|
|
CHANGELOG* documentation),
|
|
links: %{
|
|
GitHub: "https://github.com/ash-project/ash_money"
|
|
}
|
|
]
|
|
end
|
|
|
|
defp elixirc_paths(:test) do
|
|
elixirc_paths(:dev) ++ ["test/support"]
|
|
end
|
|
|
|
defp elixirc_paths(_) do
|
|
["lib"]
|
|
end
|
|
|
|
defp extras() do
|
|
"documentation/**/*.{md,livemd,cheatmd}"
|
|
|> Path.wildcard()
|
|
|> Enum.map(fn path ->
|
|
title =
|
|
path
|
|
|> Path.basename(".md")
|
|
|> Path.basename(".livemd")
|
|
|> Path.basename(".cheatmd")
|
|
|> String.split(~r/[-_]/)
|
|
|> Enum.map_join(" ", &capitalize/1)
|
|
|> case do
|
|
"F A Q" ->
|
|
"FAQ"
|
|
|
|
other ->
|
|
other
|
|
end
|
|
|
|
{String.to_atom(path),
|
|
[
|
|
title: title
|
|
]}
|
|
end)
|
|
end
|
|
|
|
defp capitalize(string) do
|
|
string
|
|
|> String.split(" ")
|
|
|> Enum.map(fn string ->
|
|
[hd | tail] = String.graphemes(string)
|
|
String.capitalize(hd) <> Enum.join(tail)
|
|
end)
|
|
end
|
|
|
|
defp groups_for_extras() do
|
|
[
|
|
Tutorials: [
|
|
~r'documentation/tutorials'
|
|
],
|
|
"How To": ~r'documentation/how_to',
|
|
Topics: ~r'documentation/topics',
|
|
DSLs: ~r'documentation/dsls'
|
|
]
|
|
end
|
|
|
|
defp docs do
|
|
[
|
|
main: "get-started-with-ash-money",
|
|
source_ref: "v#{@version}",
|
|
logo: "logos/small-logo.png",
|
|
extra_section: "GUIDES",
|
|
before_closing_head_tag: fn type ->
|
|
if type == :html do
|
|
"""
|
|
<script>
|
|
if (location.hostname === "hexdocs.pm") {
|
|
var script = document.createElement("script");
|
|
script.src = "https://plausible.io/js/script.js";
|
|
script.setAttribute("defer", "defer")
|
|
script.setAttribute("data-domain", "ashhexdocs")
|
|
document.head.appendChild(script);
|
|
}
|
|
</script>
|
|
"""
|
|
end
|
|
end,
|
|
extras: extras(),
|
|
groups_for_extras: groups_for_extras(),
|
|
groups_for_modules: [
|
|
AshMoney: [
|
|
AshMoney,
|
|
AshMoney.Types.Money
|
|
],
|
|
AshPostgres: [
|
|
AshMoney.AshPostgresExtension
|
|
],
|
|
Internals: ~r/.*/
|
|
]
|
|
]
|
|
end
|
|
|
|
# Run "mix help deps" to learn about dependencies.
|
|
defp deps do
|
|
[
|
|
{:ash, ash_version("~> 2.0 and >= 2.17.6")},
|
|
{:ex_money, "~> 5.15"},
|
|
{:ex_money_sql, "~> 1.0", optional: true},
|
|
{:ash_postgres, "~> 1.0", optional: true},
|
|
{:ash_graphql, "~> 0.26", optional: true},
|
|
{:ex_doc, github: "elixir-lang/ex_doc", only: [:dev, :test], runtime: false},
|
|
{:ex_check, "~> 0.12", only: [:dev, :test]},
|
|
{:credo, ">= 0.0.0", only: [:dev, :test], runtime: false},
|
|
{:dialyxir, ">= 0.0.0", only: [:dev, :test], runtime: false},
|
|
{:sobelow, ">= 0.0.0", only: [:dev, :test], runtime: false},
|
|
{:git_ops, "~> 2.5", only: [:dev, :test]},
|
|
{:excoveralls, "~> 0.13", only: [:dev, :test]},
|
|
{:mix_test_watch, "~> 1.0", only: :dev, runtime: false}
|
|
]
|
|
end
|
|
|
|
defp aliases do
|
|
[
|
|
sobelow: "sobelow --skip",
|
|
credo: "credo --strict",
|
|
docs: [
|
|
"docs",
|
|
"spark.replace_doc_links"
|
|
]
|
|
]
|
|
end
|
|
|
|
defp ash_version(default_version) do
|
|
case System.get_env("ASH_VERSION") do
|
|
nil -> default_version
|
|
"local" -> [path: "../ash"]
|
|
"main" -> [git: "https://github.com/ash-project/ash.git"]
|
|
version -> "~> #{version}"
|
|
end
|
|
end
|
|
end
|