-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
mix.exs
163 lines (147 loc) · 3.93 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
defmodule AshJsonApiWrapper.MixProject do
use Mix.Project
@description """
A data layer for building resources backed by external JSON APIs
"""
@version "0.1.0"
def project do
[
app: :ash_json_api_wrapper,
version: @version,
consolidate_protocols: Mix.env() != :test,
elixir: "~> 1.12",
aliases: aliases(),
start_permanent: Mix.env() == :prod,
deps: deps(),
package: package(),
elixirc_paths: elixirc_paths(Mix.env()),
dialyzer: [plt_add_apps: [:ash]],
docs: docs(),
description: @description,
source_url: "https://github.com/ash-project/ash_json_api",
homepage_url: "https://github.com/ash-project/ash_json_api"
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
defp extras() do
"documentation/**/*.md"
|> Path.wildcard()
|> Enum.map(fn path ->
title =
path
|> Path.basename(".md")
|> String.split(~r/[-_]/)
|> Enum.map(&String.capitalize/1)
|> Enum.join(" ")
|> case do
"F A Q" ->
"FAQ"
other ->
other
end
{String.to_atom(path),
[
title: title
]}
end)
end
defp groups_for_extras() do
"documentation/*"
|> Path.wildcard()
|> Enum.map(fn folder ->
name =
folder
|> Path.basename()
|> String.split(~r/[-_]/)
|> Enum.map(&String.capitalize/1)
|> Enum.join(" ")
{name, folder |> Path.join("**") |> Path.wildcard()}
end)
end
defp docs do
[
main: "AshJsonApiWrapper",
source_ref: "v#{@version}",
logo: "logos/small-logo.png",
extra_section: "GUIDES",
spark: [
extensions: [
%{
module: AshJsonApiWrapper.DataLayer,
name: "AshJsonApiWrapper",
target: "Ash.Resource",
type: "DataLayer"
}
]
],
extras: extras(),
groups_for_extras: groups_for_extras(),
groups_for_modules: [
AshJsonApiWrapper: [
AshJsonApiWrapper,
AshJsonApiWrapper.DataLayer
],
Introspection: [
AshJsonApiWrapper.DataLayer.Info
],
Internals: ~r/.*/
]
]
end
defp aliases do
[
sobelow: "sobelow --skip",
docs: ["docs", "spark.replace_doc_links"],
"spark.formatter": "spark.formatter --extensions AshJsonApiWrapper.DataLayer"
]
end
defp package do
[
name: :ash_json_api_wrapper,
licenses: ["MIT"],
files: ~w(lib .formatter.exs mix.exs README* LICENSE*
CHANGELOG* documentation),
links: %{
GitHub: "https://github.com/ash-project/ash_json_api_wrapper"
}
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ash, ash_version("~> 3.0")},
{:tesla, "~> 1.7"},
{:exjsonpath, "~> 0.1"},
# Dev/Test dependencies
{:ex_doc, "~> 0.22", only: :dev, runtime: false},
{:ex_check, "~> 0.16.0", only: :dev},
{:credo, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:dialyxir, ">= 0.0.0", only: :dev, runtime: false},
{:sobelow, "~> 0.13", only: [:dev, :test], runtime: false},
{:git_ops, "~> 2.5", only: :dev},
{:mix_test_watch, "~> 1.0", only: :dev, runtime: false},
{:parse_trans, "3.4.2", only: [:dev, :test], override: true},
{:mox, "~> 1.0", only: :test},
{:mix_audit, ">= 0.0.0", only: [:dev, :test], runtime: false}
]
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
defp elixirc_paths(:test) do
elixirc_paths(:dev) ++ ["test/support"]
end
defp elixirc_paths(_) do
["lib"]
end
end