-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathmix.exs
More file actions
110 lines (99 loc) · 3 KB
/
mix.exs
File metadata and controls
110 lines (99 loc) · 3 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
defmodule PostHog.MixProject do
use Mix.Project
@version "2.8.1"
@source_url "https://github.com/posthog/posthog-elixir"
def project do
[
app: :posthog,
version: @version,
elixir: "~> 1.17",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
package: package()
]
end
def application do
[
mod: {PostHog.Application, []},
extra_applications: [:logger]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp package do
[
name: :posthog,
maintainers: ["PostHog"],
licenses: ["MIT"],
description: "Official PostHog Elixir SDK",
links: %{"GitHub" => @source_url}
]
end
defp docs do
[
main: "readme",
favicon: "docs/favicon.svg",
logo: "docs/favicon.svg",
source_ref: "v#{@version}",
source_url: @source_url,
assets: %{
"assets" => "assets"
},
extras: ["README.md", "CHANGELOG.md", "MIGRATION.md", "guides/advanced-configuration.md"],
groups_for_modules: [
Integrations: [PostHog.Integrations.Plug, PostHog.Integrations.LLMAnalytics.Req],
Testing: [PostHog.Test]
],
skip_code_autolink_to: &String.starts_with?(&1, "Posthog"),
before_closing_body_tag: &before_closing_body_tag/1
]
end
defp deps do
[
{:nimble_options, "~> 1.1"},
{:req, "~> 0.5.10"},
{:logger_json, "~> 7.0"},
{:nimble_ownership, "~> 1.0"},
{:uuid_v7, "~> 0.6.0"},
# Development tools
{:ex_doc, "~> 0.37", only: :dev, runtime: false},
{:logger_handler_kit, "~> 0.4", only: :test},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:mox, "~> 1.1", only: :test}
]
end
defp before_closing_body_tag(:html) do
# https://hexdocs.pm/ex_doc/readme.html#rendering-mermaid-graphs
"""
<script defer src="https://cdn.jsdelivr.net/npm/mermaid@11.12.1/dist/mermaid.min.js"></script>
<script>
let initialized = false;
window.addEventListener("exdoc:loaded", () => {
if (!initialized) {
mermaid.initialize({
startOnLoad: false,
theme: document.body.className.includes("dark") ? "dark" : "default"
});
initialized = true;
}
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 before_closing_body_tag(:epub), do: ""
end