-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathmix.exs
More file actions
139 lines (123 loc) · 3.39 KB
/
mix.exs
File metadata and controls
139 lines (123 loc) · 3.39 KB
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
if File.exists?("blend/premix.exs") do
Code.compile_file("blend/premix.exs")
else
defmodule Blend.Premix do
def patch_project(project), do: project
end
end
defmodule Surface.Catalogue.MixProject do
use Mix.Project
@version "0.6.4"
@source_url "https://github.com/surface-ui/surface_catalogue"
@homepage_url "https://surface-ui.org"
def project do
[
app: :surface_catalogue,
version: @version,
elixir: "~> 1.14",
description: "An initial prototype of the Surface Catalogue",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers() ++ [:surface],
aliases: aliases(),
xref: [exclude: Surface.Catalogue.Playground],
deps: deps(),
# Docs
name: "Surface Catalogue",
source_url: @source_url,
homepage_url: @homepage_url,
docs: docs(),
package: package(),
listeners: [Phoenix.CodeReloader]
]
|> Blend.Premix.patch_project()
end
def cli do
[preferred_envs: [docs: :docs]]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {Surface.Catalogue.Application, []},
extra_applications: [:logger]
]
end
defp elixirc_paths(:dev), do: ["lib"] ++ catalogues()
defp elixirc_paths(:test), do: ["lib", "test/support"] ++ catalogues()
defp elixirc_paths(_), do: ["lib"]
def catalogues do
["priv/catalogue"] ++ surface_catalogue_path()
end
defp surface_catalogue_path() do
deps()
|> List.keyfind!(:surface, 0)
|> surface_dep_opts()
|> surface_catalogue_path()
end
defp surface_catalogue_path(nil), do: []
defp surface_catalogue_path(opts) do
path =
case opts[:path] do
nil -> Mix.Project.deps_path() |> Path.relative() |> Path.join("/surface")
surface_dep_path -> Path.expand(surface_dep_path)
end
["#{path}/priv/catalogue"]
end
defp surface_dep_opts({:surface, opts}) when is_list(opts), do: opts
defp surface_dep_opts({:surface, _req, opts}) when is_list(opts), do: opts
defp surface_dep_opts({:surface, _req}), do: []
defp surface_dep_opts(_), do: nil
defp aliases do
[
dev: "run --no-halt dev.exs"
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:surface, "~> 0.10"},
{:earmark, "~> 1.4.21"},
{:makeup_elixir, "~> 0.16.0 or ~> 1.0"},
{:html_entities, "~> 0.4"},
{:jason, "~> 1.0", only: :dev},
{:plug_cowboy, "~> 2.3", only: :dev},
{:esbuild, "~> 0.2", only: :dev},
{:blend, "~> 0.5.0", only: :dev},
{:floki, ">= 0.35.3", only: :test},
{:phoenix_live_reload, "~> 1.2", optional: true, only: [:prod, :dev]},
{:ex_doc, ">= 0.31.1", only: :docs},
{:lazy_html, ">= 0.1.0", only: :test}
]
end
defp docs do
[
main: "readme",
source_ref: "v#{@version}",
nest_modules_by_prefix: [Surface.Catalogue],
extras: [
"README.md",
"CHANGELOG.md",
"LICENSE.md"
]
]
end
defp package do
%{
licenses: ["MIT"],
links: %{
Website: @homepage_url,
Changelog: "https://hexdocs.pm/surface_catalogue/changelog.html",
GitHub: @source_url
},
files: ~w(
README.md
CHANGELOG.md
LICENSE.md
mix.exs
lib
assets
priv/catalogue
)
}
end
end