-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmix.exs
117 lines (106 loc) · 3 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
defmodule Demo.MixProject do
use Mix.Project
def project do
[
app: :demo,
version: "0.1.0",
elixir: "~> 1.12",
compilers: [:boundary | Mix.compilers()],
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
preferred_cli_env: preferred_cli_env(),
deps: deps(),
dialyzer: dialyzer(),
boundary: boundary()
]
end
def application do
[
mod: {Demo.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp deps do
[
{:bcrypt_elixir, "~> 3.0"},
{:boundary, "~> 0.9"},
{:credo, "~> 1.6", runtime: false},
{:dialyxir, "~> 1.1", runtime: false},
{:ecto_sql, "~> 3.6"},
{:esbuild, "~> 0.3", runtime: Mix.env() == :dev},
{:floki, ">= 0.30.0", only: :test},
{:gettext, "~> 0.20"},
{:jason, "~> 1.2"},
{:oban, "~> 2.14"},
{:parent, "~> 0.12"},
{:phoenix_ecto, "~> 4.4"},
{:phoenix_html, "~> 3.0"},
{:phoenix_live_dashboard, "~> 0.8.0"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.20.0"},
{:phoenix, "~> 1.7"},
{:plug_cowboy, "~> 2.5"},
{:postgrex, ">= 0.0.0"},
{:provider, "~> 0.1.0"},
{:swoosh, "~> 1.6"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"}
]
end
defp aliases do
[
setup: ["deps.get", "ecto.setup"],
"ecto.setup": ["ecto.create", "ecto.migrate"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
"assets.deploy": ["esbuild default --minify", "phx.digest"],
release: ["assets.deploy", "release"],
"demo.ci": [
"format --check-formatted",
"test",
"credo",
"xref graph --label compile-connected --fail-above 0",
"dialyzer"
],
"boundary.visualize": ["boundary.visualize", &create_boundary_pngs/1]
]
end
defp preferred_cli_env do
["demo.ci": :test, release: :prod]
end
defp dialyzer do
[plt_add_apps: [:ex_unit, :mix]]
end
defp boundary do
[
default: [
check: [
aliases: true,
apps: [
{:mix, :runtime}
]
]
]
]
end
defp create_boundary_pngs(_args) do
if System.find_executable("dot") do
png_dir = Path.join(~w/boundary png/)
File.rm_rf(png_dir)
File.mkdir_p!(png_dir)
Enum.each(
Path.wildcard(Path.join("boundary", "*.dot")),
fn dot_file ->
png_file = Path.join([png_dir, "#{Path.basename(dot_file, ".dot")}.png"])
System.cmd("dot", ~w/-Tpng #{dot_file} -o #{png_file}/)
end
)
Mix.shell().info([:green, "Generated png files in #{png_dir}"])
else
Mix.shell().info([:yellow, "Install graphviz package to enable generation of png files."])
end
end
end