forked from liveview-native/liveview-client-swiftui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mix.exs
132 lines (117 loc) · 3.79 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
defmodule LiveViewNative.SwiftUI.MixProject do
use Mix.Project
@version "0.3.0-rc.1"
@source_url "https://github.com/liveview-native/liveview-client-swiftui"
def project do
[
app: :live_view_native_swiftui,
version: @version,
elixir: "~> 1.15",
description: description(),
start_permanent: Mix.env() == :prod,
deps: deps(),
package: package(),
elixirc_paths: elixirc_paths(Mix.env()),
docs: docs(),
aliases: aliases()
]
end
def application do
[
extra_applications: [:logger]
]
end
def cli do
[
preferred_envs: [docs: :docs, "hex.publish": :docs]
]
end
defp aliases do
[
docs: ["lvn.swiftui.gen.docs", "docs"]
]
end
defp elixirc_paths(:docs), do: ["lib"]
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ignore_docs_task(["lib"])
defp ignore_docs_task(paths) do
Enum.flat_map(paths, fn(path) ->
Path.wildcard("#{path}/**/*.ex")
end)
|> Enum.filter(&(!(&1 =~ "lvn.swiftui.gen.docs")))
end
defp deps do
[
{:ex_doc, ">= 0.0.0", only: [:docs, :test]},
{:makeup_swift, "~> 0.0.1", only: [:docs, :test]},
{:makeup_json, "~> 0.1.0", only: [:docs, :test]},
{:makeup_eex, ">= 0.1.1"},
{:floki, ">= 0.30.0", only: :test},
# {:live_view_native, "~> 0.3.0-rc.1"},
{:live_view_native, github: "liveview-native/live_view_native", override: true},
{:live_view_native_stylesheet, "~> 0.3.0-rc.1", only: :test},
{:live_view_native_test, github: "liveview-native/live_view_native_test", branch: "main", only: :test},
{:nimble_parsec, "~> 1.3"}
]
end
defp docs do
guides = Path.wildcard("guides/**/*.md")
generated_docs = Path.wildcard("generated_docs/**/*.{md,cheatmd}")
extras = ["README.md"] ++ guides ++ generated_docs
guide_groups = [
"Architecture": Path.wildcard("guides/architecture/*.md")
]
generated_groups =
Path.wildcard("generated_docs/*")
|> Enum.map(&({Path.basename(&1) |> String.to_atom(), Path.wildcard("#{&1}/*.md")}))
[
extras: extras,
groups_for_extras: guide_groups ++ generated_groups,
groups_for_functions: [
Components: &(&1[:type] == :component),
Macros: &(&1[:type] == :macro)
],
main: "readme",
source_url: @source_url,
source_ref: "v#{@version}",
before_closing_body_tag: %{
html: """
<script src="https://cdn.jsdelivr.net/npm/mermaid@10.2.3/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
mermaid.initialize({
startOnLoad: false,
theme: document.body.className.includes("dark") ? "dark" : "default"
});
let id = 0;
for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
const preEl = codeEl.parentElement;
const graphDefinition = codeEl.textContent;
const graphEl = document.createElement("div");
const graphId = "mermaid-graph-" + id++;
mermaid.render(graphId, graphDefinition).then(({svg, bindFunctions}) => {
graphEl.innerHTML = svg;
bindFunctions?.(graphEl);
preEl.insertAdjacentElement("afterend", graphEl);
preEl.remove();
});
}
});
</script>
"""
}
]
end
defp description, do: "LiveView Native SwiftUI Client"
defp package do
%{
maintainers: ["Brian Cardarella"],
licenses: ["MIT"],
links: %{
"GitHub" => @source_url,
"Built by DockYard, Expert Elixir & Phoenix Consultants" =>
"https://dockyard.com/phoenix-consulting"
}
}
end
end