-
Notifications
You must be signed in to change notification settings - Fork 5
/
mix.exs
113 lines (100 loc) · 2.33 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
defmodule Sqids.MixProject do
use Mix.Project
@version "0.2.0"
@source_url "https://github.com/sqids/sqids-elixir"
def project do
mix_env = Mix.env()
[
app: :sqids,
version: @version,
description: description(),
elixir: "~> 1.7",
start_permanent: mix_env === :prod,
deps: deps(),
elixirc_paths: elixirc_paths(mix_env),
elixirc_options: elixirc_options(mix_env),
docs: docs(),
test_coverage: [
summary: [
threshold: 93
]
],
dialyzer: [plt_add_apps: [:ex_unit]],
package: package()
]
end
defp description do
"Generate YouTube-looking IDs from numbers"
end
defp deps do
List.flatten([
{:ex_doc, "~> 0.30", only: :dev, runtime: false},
{:recon, "~> 2.5", only: [:dev, :test], runtime: false},
{:sqids_blocklist,
github: "sqids/sqids-blocklist", branch: "main", only: :dev, runtime: false, app: false, compile: false},
maybe_credo_dep(),
maybe_dialyxir_dep(),
maybe_styler_dep()
])
end
defp maybe_credo_dep do
if elixir_vsn_match?("~> 1.12") do
{:credo, "~> 1.7", only: [:dev, :test], runtime: false}
else
[]
end
end
defp maybe_dialyxir_dep do
if elixir_vsn_match?("~> 1.12") do
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
else
[]
end
end
defp maybe_styler_dep do
if elixir_vsn_match?("~> 1.14") do
{:styler, "~> 1.1", only: [:dev, :test], runtime: false}
else
[]
end
end
defp elixirc_paths(env) do
if env === :test do
["lib", "test/extra"]
else
["lib"]
end
end
defp elixirc_options(env) do
if env === :test do
[warnings_as_errors: true]
else
[]
end
end
defp docs do
[
main: "readme",
name: "Sqids",
source_ref: @version,
canonical: "http://hexdocs.pm/sqids",
source_url: @source_url,
extras: [
"CHANGELOG.md",
"LICENSE",
"README.md": [title: "Sqids"]
]
]
end
defp package do
[
maintainers: ["Guilherme Andrade"],
licenses: ["MIT"],
links: %{
"About Sqids" => "https://sqids.org/",
"GitHub" => @source_url
}
]
end
defp elixir_vsn_match?(requirement), do: Version.match?(System.version(), requirement)
end